且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

NLTK 和语言检测

更新时间:2023-02-26 13:44:49

您是否遇到过以下代码片段?

Have you come across the following code snippet?

english_vocab = set(w.lower() for w in nltk.corpus.words.words())
text_vocab = set(w.lower() for w in text if w.lower().isalpha())
unusual = text_vocab.difference(english_vocab) 

来自 http://groups.google.com/group/nltk-users/browse_thread/thread/a5f52af2cbc4cfeb?pli=1&safe=active

或者下面的演示文件?

https://web.archive.org/web/20120202055535/http://code.google.com/p/nltk/source/browse/trunk/nltk_contrib/nltk_contrib/misc/langid.py