Wolfram Language

Open live version

Compare Old and Modern English

How do the word lengths of Old English and Modern English compare?


code

Histogram[{ StringLength /@ StringSplit[ExampleData[{"Text", "BeowulfOldEnglish"}]], StringLength /@ StringSplit[ExampleData[{"Text", "BeowulfModern"}]] }, ChartLegends -> {"Old English", "Modern"}]

how it works

This example was live-coded at the Wolfram Research booth at SXSW, March 9, 2014.

Split the original text of Beowulf into words:

oldEnglishBeowulfWords = StringSplit[ExampleData[{"Text", "BeowulfOldEnglish"}]]

Find the lengths of the words:

oldEnglishBeowulfWordLengths = StringLength /@ oldEnglishBeowulfWords

Do the same with a modern translation of Beowulf:

modernEnglishBeowulfWordLengths = StringLength /@ StringSplit[ExampleData[{"Text", "BeowulfModern"}]]

Compare the word lengths in a histogram. You can see that Modern English has many more short words and Old English more long words:

Histogram[{ oldEnglishBeowulfWordLengths, modernEnglishBeowulfWordLengths }, ChartLegends -> {"Old English", "Modern"}]