コード例 #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
コード例 #2
0
ファイル: dawg.py プロジェクト: ChimmyTee/oh-mainline
 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
コード例 #3
0
ファイル: wordnet.py プロジェクト: BenSchwab/portfolio
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
コード例 #4
0
ファイル: wordnet.py プロジェクト: skrieder/microblog
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
コード例 #5
0
ファイル: fst.py プロジェクト: adamhorner/yaki-tng
 def __iter__(self):
     if not self._edges:
         self._load()
     return iterkeys(self._edges)
コード例 #6
0
ファイル: dawg.py プロジェクト: skrieder/microblog
 def __iter__(self):
     if not self._edges:
         self._load()
     return iterkeys(self._edges)