def parse(word):
"""Interpret word as a fTerm word."""
if word in synonyms.values():
return word
elif word in synonyms:
return synonyms[word]
else:
lookup = get_close_matches(word, verbs.keys() + synonyms.keys())
if len(lookup) == 0:
# there aren't any reasonable matches
raise KeyError
else:
if lookup[0] in synonyms:
return synonyms[lookup[0]]
else:
return lookup[0]
评论列表
文章目录