2017-06-09 2 views
7

NLTK単語コーパスには「okay」、「ok」、「Okay」というフレーズはありませんか?nltk words corpusに「okay」が含まれていませんか?

> from nltk.corpus import words 
> words.words().__contains__("check") 
> True 

> words.words().__contains__("okay") 
> False 

> len(words.words()) 
> 236736 

なぜでしょうか?

+0

Heh、TIL「zymolysis」、「okupukupu」、多くの曖昧な単語がコーパスにあり、「okay」はそうではありません。おそらくそれを[nltk github](https://github.com/nltk/nltk)で尋ねるか、別のコーパスを使うべきです。 – umutto

+0

特定のコーパスの内容の詳細は、誰かがそれに答えることができるとしても、プログラミング上の質問ではなく、かなり明確ではない話題です。コーパスのメンテナーに尋ねる方が賢明だと思われる。 – pvg

+0

私は@kindallに同意します –

答えて

7

TL; DR

from nltk.corpus import words 
from nltk.corpus import wordnet 

manywords = words.words() + wordnet.words() 

ロング

docsから、nltk.corpus.wordsは言葉が

http://en.wikipedia.org/wiki/Words_(Unix)は、UNIXで、あなたが行うことができます」からの単語のリストは以下のとおりです。

ls /usr/share/dict/ 

そして、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. 

それはの固定リストがありますのでが、そのリストには存在しない単語があるようにバインドされています。

単語リストを拡張する必要がある場合は、nltk.corpus.wordnet.words()を使用してWordNetの単語を使用してリストに追加できます。

ほとんどの場合、必要なものは十分に大きなテキストのコーパスです。 Wikipediaをダンプしてトークン化し、すべてのユニークな単語を抽出します。

+2

'あなたが探している単語を含むコーパスがあります。'なぜこのコーパスにはこの単語が含まれていないのですか? 「TL; DR」がどのように適用可能であるか説明的であるかは明確ではない。 – pvg

+0

@alvasありがとうございました。これは私がすでに行ってきたもので、カスタム辞書を使用しています。全部で3つの辞書。いいえ説明 – MonsieurBeilto

+2

nltk.corpusからwnとしてワードネットをインポートしますか? –

関連する問題