WordFrequency[text,word]
text 中の word の頻度を与える.
WordFrequency[text,{word1,word2,…}]
各 wordiの頻度の連想を与える.
WordFrequency
WordFrequency[text,word]
text 中の word の頻度を与える.
WordFrequency[text,{word1,word2,…}]
各 wordiの頻度の連想を与える.
詳細とオプション
- WordFrequency[text,word]は,word の出現回数を text 中の総単語数で割った数を与える.
- WordFrequency[text,word]では,word はスペースを含む複数の単語からなる文字列でもよい.nグラム文字列については,結果が text 中のnグラムの総数で割られる.
- WordFrequency[text,word1|word2|…]は,すべての wordiについての総頻度を与える.
- WordFrequency[{text1,text2,…},word]は,textiのそれぞれについての頻度のリストを与える.
- 使用可能なオプション
-
IgnoreCase False 大文字小文字の違いを無視するかどうか - WordFrequency[text,word,"CaseVariants"]は,大文字小文字が違うすべての形の頻度を含む連想を与える.
例題
すべて開く すべて閉じる例 (2)
スコープ (7)
基本的な用法 (4)
WordFrequency["James while John had had had had had had had had had had had a better effect on the teacher", "had"]WordFrequency["James while John had had had had had had had had had had had a better effect on the teacher", { "had", "the", "on"}]代替パターンを使った場合は,マッチするパターンについての総頻度が返される:
WordFrequency["James while John had had had had had had had had had had had a better effect on the teacher", "the" | "on"]複数の代替パターンが指定された場合は,そのそれぞれについて頻度が与えられる:
WordFrequency["James while John had had had had had had had had had had had a better effect on the teacher", {"the" | "on", "had had" | "on the"}, IgnoreCase -> True]大文字小文字 (3)
単語は大文字小文字が違うたくさんの書き方を使うことができる:
WordFrequency["That that is, is that THAT is. Not is not. Is that it? It is", "that", "CaseVariants"]複数の語の入力では,出現した各単語について大文字小文字の違う形が返される:
WordFrequency["That that is, is that THAT is. Not is not. Is that it? It is", {"that", "it"}, "CaseVariants"]大文字小文字を区別した単語の明示的なリストを与えることもできる:
WordFrequency["That that is, is that THAT is. Not is not. Is that it? It is", {"that", "That", "THAT", "it", "It"}]"CaseVariants"である複数の単語はリストとして返される:
WordFrequency["That that is, is that THAT is. Not is not. Is that it? It is", {"that" | "not", "is is" | "that that"}, "CaseVariants"]オプション (1)
IgnoreCase (1)
デフォルトで,指定された単語の大文字小文字の別にマッチする単語のみについての頻度が返される:
WordFrequency["Buffalo from Buffalo, which buffalo from Buffalo bully, themselves bully buffalo from Buffalo.", "Buffalo"]IgnoreCase->Trueとすると,大文字小文字が違うものも一緒に数えられる:
WordFrequency["Buffalo from Buffalo, which buffalo from Buffalo bully, themselves bully buffalo from Buffalo.", "Buffalo", IgnoreCase -> True]考えられる問題 (2)
IgnoreCase->Trueとすると,大文字小文字の使い方が違う形についてのキーは結果の連想から除かれる:
WordFrequency["Sentences should Be split by Words, and words may be split by letters", {"words", "be", "Be", "BE"}, IgnoreCase -> True]WordFrequency[ExampleData[{"Text", "DeclarationOfIndependence"}], "beltalowda"]おもしろい例題 (2)
「Alice in Wonderland」(不思議の国のアリス)のサンプルの,冠詞の頻度:
WordFrequency[ExampleData[{"Text", "AliceInWonderland"}], {"a", "an", "the"}, "CaseVariants"]WordFrequency[ExampleData[{"Text", "AliceInWonderland"}], {"a", "an", "the"}, IgnoreCase -> True]上記書籍の登場人物の名前の頻度を使ってワードクラウドを作る:
WordCloud[WordFrequency[ExampleData[{"Text", "AliceInWonderland"}], {"Alice", "Queen", "Rabbit", "Duchess", "King", "Mouse", "Hatter", "Cat", "Dodo", "Caterpillar"}, IgnoreCase -> True]]英語のウィキペディアの「Moon」についての記事中の「mission」という単語の頻度:
WordFrequency[WikipediaData["Moon"], "mission", IgnoreCase -> True]関連するワークフロー
- Webページのテキストを解析する
テキスト
Wolfram Research (2016), WordFrequency, Wolfram言語関数, https://reference.wolfram.com/language/ref/WordFrequency.html.
CMS
Wolfram Language. 2016. "WordFrequency." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WordFrequency.html.
APA
Wolfram Language. (2016). WordFrequency. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WordFrequency.html
BibTeX
@misc{reference.wolfram_2026_wordfrequency, author="Wolfram Research", title="{WordFrequency}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/WordFrequency.html}", note=[Accessed: 03-December-2026]}
BibLaTeX
@online{reference.wolfram_2026_wordfrequency, organization={Wolfram Research}, title={WordFrequency}, year={2016}, url={https://reference.wolfram.com/language/ref/WordFrequency.html}, note=[Accessed: 03-December-2026]}