Exemplo n.º 1
0
def simple_single_word_cand_gen(w, dictionary):
    return set(e1 for e1 in norvig.edits1(w) if e1 in dictionary)
Exemplo n.º 2
0
def simple_word_cand_gen(w, dictionary):
    return set(e2 for e1 in norvig.edits1(w) for e2 in norvig.edits1(e1) if e2 in dictionary)
Exemplo n.º 3
0
def simple_single_word_cand_gen(w, dictionary):
    return set(e1 for e1 in norvig.edits1(w) if e1 in dictionary)
Exemplo n.º 4
0
"""
Let's see how big and spacey a dict of 1-edits of all words would be.
"""

import norvig as speller

s = speller.Speller()
s.load(open('bigdict'))

edits = set()
for i, word in enumerate(s.d):
    #if i % 1000: print '.',
    edits |= set(speller.edits1(word))
print ''

print len(edits), sum(map(len, edits)), len(s.d)
Exemplo n.º 5
0
def simple_word_cand_gen(w, dictionary):
    return set(e2 for e1 in norvig.edits1(w) for e2 in norvig.edits1(e1)
               if e2 in dictionary)