テキスト内の単語を分析する
StringCasesを使うと,単語を含めた特定の文字列をテキストから取り出すことができる.
words = ToLowerCase[StringCases[Import["ExampleData/USConstitution.txt"], WordCharacter..]];Length[words]Length[Union[words]]ListLogPlot[Sort[Last /@ Tally[words]], PlotRange -> All]Take[Sort[Reverse /@ Tally[words]], -10]