0
私は、茶色のコーパスの異なるジャンルのいくつかの単語の度数分布を見出しています。pythonの 'sample'と 'samples'キーワードの違いnltk ConditionalFreqDist
マイコード:上記のコードのための
import nltk
from nltk.corpus import brown
cfd = nltk.ConditionalFreqDist(
(genre, word)
for genre in brown.categories()
for word in brown.words(categories = genre))
genres = ['news', 'religion', 'hobbies', 'science_fiction', 'romance', 'humor']
modals = ['can', 'could', 'may', 'might', 'must', 'will']
cfd.tabulate(conditions = genres, samples = modals)
出力:
can could may might must will
news 93 86 66 38 50 389
religion 82 59 78 12 54 71
hobbies 268 58 131 22 83 264
science_fiction 16 49 4 12 8 16
romance 74 193 11 51 45 43
humor 16 30 8 8 9 13
しかし、私は上記のコードの最後の行に 'サンプル' で 'サンプル' を交換するとき。コーパス内のすべての単語に対してFreqDistを与えます。
「サンプル」と「サンプル」の違いは分かりませんが、
ありがとうございます。
回答ありがとうございます – a0n1i2k3
私の喜び、それは助けて欲しい:) –