TL; DR
from nltk.corpus import words
from nltk.corpus import wordnet
manywords = words.words() + wordnet.words()
Trong dài
Từ docs, các nltk.corpus.words
là những từ một danh sách các từ từ "http://en.wikipedia.org/wiki/Words_(Unix)
nào trong Unix, bạn có thể làm:
ls /usr/share/dict/
Và đọc README:
$ cd /usr/share/dict/
/usr/share/dict$ cat README
# @(#)README 8.1 (Berkeley) 6/5/93
# $FreeBSD$
WEB ---- (introduction provided by [email protected]) -------------------------
Welcome to web2 (Webster's Second International) all 234,936 words worth.
The 1934 copyright has lapsed, according to the supplier. The
supplemental 'web2a' list contains hyphenated terms as well as assorted
noun and adverbial phrases. The wordlist makes a dandy 'grep' victim.
-- James A. Woods {ihnp4,hplabs}!ames!jaw (or [email protected])
Country names are stored in the file /usr/share/misc/iso3166.
FreeBSD Maintenance Notes ---------------------------------------------
Note that FreeBSD is not maintaining a historical document, we're
maintaining a list of current [American] English spellings.
A few words have been removed because their spellings have depreciated.
This list of words includes:
corelation (and its derivatives) "correlation" is the preferred spelling
freen typographical error in original file
freend archaic spelling no longer in use;
masks common typo in modern text
--
A list of technical terms has been added in the file 'freebsd'. This
word list contains FreeBSD/Unix lexicon that is used by the system
documentation. It makes a great ispell(1) personal dictionary to
supplement the standard English language dictionary.
Kể từ đó là một danh sách cố định của 234.936, có ràng buộc để được lời rằng không tồn tại trong danh sách đó.
Nếu bạn cần mở rộng danh sách từ, bạn có thể thêm vào danh sách bằng các từ từ WordNet sử dụng nltk.corpus.wordnet.words()
.
Có thể, tất cả những gì bạn cần là một văn bản đủ lớn văn bản, ví dụ: Wikipedia đổ và sau đó tokenize nó và trích xuất tất cả các từ duy nhất.
Heh, TIL 'zymolysis',' okupukupu' và rất nhiều từ mơ hồ nằm trong kho trong khi 'okay' thì không. Bạn có lẽ nên hỏi nó trong [nltk github] (https://github.com/nltk/nltk) hoặc sử dụng một kho văn bản khác nhưng tốt. – umutto
Thông tin chi tiết về nội dung của một số kho văn bản cụ thể không phải là câu hỏi lập trình, ngay cả khi ai đó có thể trả lời nó, nó khá rõ ràng ngoài chủ đề. Có vẻ hợp lý hơn khi hỏi những người bảo quản. – pvg
Tôi đồng ý với @kindall –