222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
if sWord not in self._dLemmas:
self.getMorph(sWord)
return self._dLemmas[sWord]
return set([ s[1:s.find(" ")] for s in self.getMorph(sWord) ])
def suggest (self, sWord, nSuggLimit=10):
"generator: returns 1, 2 or 3 lists of suggestions"
if self.dDefaultSugg and sWord in self.dDefaultSugg:
yield self.dDefaultSugg[sWord].split("|")
else:
yield self.oMainDic.suggest(sWord, nSuggLimit)
if self.bExtendedDic:
yield self.oExtendedDic.suggest(sWord, nSuggLimit)
if self.bCommunityDic:
yield self.oCommunityDic.suggest(sWord, nSuggLimit)
if self.bPersonalDic:
|
|
>
|
>
>
>
>
>
|
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
if sWord not in self._dLemmas:
self.getMorph(sWord)
return self._dLemmas[sWord]
return set([ s[1:s.find(" ")] for s in self.getMorph(sWord) ])
def suggest (self, sWord, nSuggLimit=10):
"generator: returns 1, 2 or 3 lists of suggestions"
if self.dDefaultSugg:
if sWord in self.dDefaultSugg:
yield self.dDefaultSugg[sWord].split("|")
elif sWord.istitle() and sWord.lower() in self.dDefaultSugg:
lRes = self.dDefaultSugg[sWord.lower()].split("|")
yield list(map(lambda sSugg: sSugg[0:1].upper()+sSugg[1:], lRes))
else:
yield self.oMainDic.suggest(sWord, nSuggLimit)
else:
yield self.oMainDic.suggest(sWord, nSuggLimit)
if self.bExtendedDic:
yield self.oExtendedDic.suggest(sWord, nSuggLimit)
if self.bCommunityDic:
yield self.oCommunityDic.suggest(sWord, nSuggLimit)
if self.bPersonalDic:
|