Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
e9f04ae7
Commit
e9f04ae7
authored
Jun 27, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged bug fixes from 2.2
parent
1ac25b49
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
lib/python/SearchIndex/Lexicon.py
lib/python/SearchIndex/Lexicon.py
+7
-6
No files found.
lib/python/SearchIndex/Lexicon.py
View file @
e9f04ae7
...
@@ -104,15 +104,17 @@ import re
...
@@ -104,15 +104,17 @@ import re
class
Lexicon
(
Persistent
,
Implicit
):
class
Lexicon
(
Persistent
,
Implicit
):
"""
m
aps words to word ids and then some
"""
M
aps words to word ids and then some
The Lexicon object is an attempt to abstract vo
ac
bularies out of
The Lexicon object is an attempt to abstract vo
ca
bularies out of
Text indexes. This abstraction is not totally cooked yet, this
Text indexes. This abstraction is not totally cooked yet, this
module still includes the parser for the 'Text Index Query
module still includes the parser for the 'Text Index Query
Language' and a few other hacks.
Language' and a few other hacks.
"""
"""
# default for older objects
stop_syn
=
{}
def
__init__
(
self
,
stop_syn
=
None
):
def
__init__
(
self
,
stop_syn
=
None
):
self
.
_lexicon
=
OIBTree
()
self
.
_lexicon
=
OIBTree
()
...
@@ -120,10 +122,10 @@ class Lexicon(Persistent, Implicit):
...
@@ -120,10 +122,10 @@ class Lexicon(Persistent, Implicit):
if
stop_syn
is
None
:
if
stop_syn
is
None
:
self
.
stop_syn
=
{}
self
.
stop_syn
=
{}
else
:
else
:
self
.
stop_syn
=
{}
self
.
stop_syn
=
stop_syn
def
set_stop_syn
(
self
b
,
stop_syn
):
def
set_stop_syn
(
self
,
stop_syn
):
""" pass in a mapping of stopwords and synonyms. Format is:
""" pass in a mapping of stopwords and synonyms. Format is:
{'word' : [syn1, syn2, ..., synx]}
{'word' : [syn1, syn2, ..., synx]}
...
@@ -160,9 +162,8 @@ class Lexicon(Persistent, Implicit):
...
@@ -160,9 +162,8 @@ class Lexicon(Persistent, Implicit):
def
Splitter
(
self
,
astring
,
words
=
None
):
def
Splitter
(
self
,
astring
,
words
=
None
):
""" wrap the splitter """
""" wrap the splitter """
if
words
is
None
:
if
words
is
None
:
word
=
self
.
stop_syn
word
s
=
self
.
stop_syn
return
Splitter
(
astring
,
words
)
return
Splitter
(
astring
,
words
)
def
grep
(
self
,
query
):
def
grep
(
self
,
query
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment