Wolfram Language

Improved Machine Learning

Find the Distribution of English Words' Frequency

Count the occurrence of words in the US Constitution.

In[1]:=
Click for copyable input
text = ExampleData[{"Text", "USConstitution"}, "Words"]; wordCount = Values[Counts[text]];

Find a simple distribution for the word counts.

In[2]:=
Click for copyable input
e\[ScriptCapitalD] = FindDistribution[wordCount]
Out[2]=

Compare the found distribution with the word counts.

show complete Wolfram Language input
In[3]:=
Click for copyable input
Show[Histogram[wordCount, {0.5, 15.5, 1}, "ProbabilityDensity", PlotLabel -> "Word Count Distribution"], DiscretePlot[PDF[e\[ScriptCapitalD], x], {x, 1, 15}, PlotStyle -> PointSize[Large], PlotLegends -> {"e\[ScriptCapitalD]"}]]
Out[3]=

Related Examples

de es fr ja ko pt-br ru zh