38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
self.nMaxDist = 0
self.aSugg = set()
self.dSugg = { 0: [], 1: [], 2: [] }
def addSugg (self, sSugg, nDeep=0):
"add a suggestion"
if sSugg not in self.aSugg:
nDist = st.distanceSift4(self.sCleanWord, cp.cleanWord(sSugg))
if nDist <= self.nDistLimit:
if nDist not in self.dSugg:
self.dSugg[nDist] = []
self.dSugg[nDist].append(sSugg)
logging.info((nDeep * " ") + "__" + sSugg + "__")
if nDist > self.nMaxDist:
self.nMaxDist = nDist
|
|
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
self.nMaxDist = 0
self.aSugg = set()
self.dSugg = { 0: [], 1: [], 2: [] }
def addSugg (self, sSugg, nDeep=0):
"add a suggestion"
if sSugg not in self.aSugg:
nDist = st.distanceDamerauLevenshtein(self.sCleanWord, cp.cleanWord(sSugg))
if nDist <= self.nDistLimit:
if nDist not in self.dSugg:
self.dSugg[nDist] = []
self.dSugg[nDist].append(sSugg)
logging.info((nDeep * " ") + "__" + sSugg + "__")
if nDist > self.nMaxDist:
self.nMaxDist = nDist
|