我想检查一个Python程序,如果一个单词在英语词典中。我相信nltk wordnet界面可能是要走的路,但我不知道如何将它用于这么简单的任务。def is_english_word(word): pass # how to I implement is_english_word?is_english_word(token.lower())在将来,我可能想检查一个单词的单数形式是否在字典中(例如,属性 - >属性 - >英语单词)。我怎么做到这一点?
3 回答

慕的地8271018
TA贡献1796条经验 获得超4个赞
使用NLTK:
from nltk.corpus import wordnet
if not wordnet.synsets(word_to_test):
#Not an English Word
else:
#English Word
如果您在安装wordnet时遇到问题或想尝试其他方法,请参阅本文。
添加回答
举报
0/150
提交
取消