81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
-
+
|
self.stem = self._stem2
self._lookupArcNode = self._lookupArcNode2
self._getArcs = self._getArcs2
self._writeNodes = self._writeNodes2
elif self.nVersion == 3:
self.morph = self._morph3
self.stem = self._stem3
self._getArcs = self._getArcs3
self._lookupArcNode = self._lookupArcNode3
self._getArcs = self._getArcs3
self._writeNodes = self._writeNodes3
else:
raise ValueError(" # Error: unknown code: {}".format(self.nVersion))
self.bOptNumSigle = False
self.bOptNumAtLast = False
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
-
|
l.extend(self.morph(sWord.lower()))
if sWord.isupper() and len(sWord) > 1:
l.extend(self.morph(sWord.capitalize()))
return l
def suggest (self, sWord, nMaxSugg=10):
"returns a set of suggestions for <sWord>"
#return self._suggestWithCrushedUselessChars(cp.clearWord(sWord))
aSugg = set()
if sWord.istitle():
aSugg.update(self._suggest(sWord, nMaxDel=len(sWord) // 5))
aSugg.update(self._suggest(sWord.lower(), nMaxDel=len(sWord) // 5))
aSugg = set(map(lambda sSugg: sSugg.title(), aSugg))
elif sWord.islower():
aSugg.update(self._suggest(sWord, nMaxDel=len(sWord) // 5))
|