in en/pythonpath/lightproof_impl_en.py [0:0]
def _morph(rLoc, word, pattern, all, onlyaffix):
global analyses
if not word:
return None
if word not in analyses:
x = spellchecker.spell(u"<?xml?><query type='analyze'><word>" + word + "</word></query>", rLoc, ())
if not x:
return None
t = x.getAlternatives()
if not t:
t = [""]
analyses[word] = t[0].split("</a>")[:-1]
a = analyses[word]
result = None
p = re.compile(pattern)
for i in a:
if onlyaffix:
i = onlymorph(i)
result = p.search(i)
if result:
result = result.group(0)
if not all:
return result
elif all:
return None
return result