天天看点

python判断一个单词是否为有效的英文单词?——三种方法

Using a set to store the word list because looking them up will be faster:

To answer the second part of the question, the plurals would already be in a good word list, but if you wanted to specifically exclude those from the list for some reason, you could indeed write a function to handle it. But English pluralization rules are tricky enough that I'd just include the plurals in the word list to begin with.

Using NLTK:

摘自:https://stackoverflow.com/questions/3788870/how-to-check-if-a-word-is-an-english-word-with-python

本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/7771609.html,如需转载请自行联系原作者