Exemple #1
0
 def __eq__(self, other):
     if self.final != other.final:
         return False
     mine, theirs = self._edges, other._edges
     if len(mine) != len(theirs):
         return False
     for key in iterkeys(mine):
         if key not in theirs or not mine[key] == theirs[key]:
             return False
     return True
Exemple #2
0
 def __eq__(self, other):
     if self.final != other.final:
         return False
     mine, theirs = self._edges, other._edges
     if len(mine) != len(theirs):
         return False
     for key in iterkeys(mine):
         if key not in theirs or not mine[key] == theirs[key]:
             return False
     return True
Exemple #3
0
def make_index(storage, indexname, word2nums, num2words):
    """Creates a Whoosh index in the given storage object containing
    synonyms taken from word2nums and num2words. Returns the Index
    object.
    """

    schema = Schema(word=ID, syns=STORED)
    ix = storage.create_index(schema, indexname=indexname)
    w = ix.writer()
    for word in iterkeys(word2nums):
        syns = synonyms(word2nums, num2words, word)
        w.add_document(word=text_type(word), syns=syns)
    w.commit()
    return ix
Exemple #4
0
def make_index(storage, indexname, word2nums, num2words):
    """Creates a Whoosh index in the given storage object containing
    synonyms taken from word2nums and num2words. Returns the Index
    object.
    """

    schema = Schema(word=ID, syns=STORED)
    ix = storage.create_index(schema, indexname=indexname)
    w = ix.writer()
    for word in iterkeys(word2nums):
        syns = synonyms(word2nums, num2words, word)
        w.add_document(word=text_type(word), syns=syns)
    w.commit()
    return ix
Exemple #5
0
 def __iter__(self):
     if not self._edges:
         self._load()
     return iterkeys(self._edges)
Exemple #6
0
 def __iter__(self):
     if not self._edges:
         self._load()
     return iterkeys(self._edges)