Gist 2116a7bda7ef9a6364f3
✓ Published0🌍 Public
MMartiHearst
Last edited Sep 5, 2014
Created on Sep 5, 2014
This example demonstrates how to use NLTK’s frequency distribution object to analyze word frequencies in the pre‑loaded text of Monty Python and the Holy Grail. It first displays the top 50 most frequent words, then guides the viewer through tasks that involve examining the raw text, modifying it, and rerunning the frequency calculation. A cumulative frequency plot is generated, and a list comprehension isolates words longer than five characters that occur at least five times, sorted alphabetically. The code relies on NLTK’s `FreqDist` and the `nltk.book` collection.
AI-generated description