liveBook · Manning

Rare word

As explained in Outlier Detection in Python

A rare word is a word that occurs substantially less often than other words in a reference text collection.

A rare word occurs substantially less often than other words in a reference text collection. Detecting it requires comparing word frequencies across the full collection, not merely within one document. section 9.3.1

A practical detection workflow:

  • Normalize text by lowercasing words and removing nonalphabetic content so different cases do not create separate counts. section 9.3.1
  • Count each word across all records, then assign every document the frequency of its least-frequent word. section 9.3.1
  • Also consider the number of rare words or the document’s mean word frequency, because one unusual word may be less informative than a broader pattern. section 9.3.1

20 Newsgroups

Among 11,314 cleaned documents, 121 contained a word used only once. That threshold may be less useful than searching for documents containing many rare words. section 9.3.1

How Outlier Detection in Python covers it

How deep it goes
Explains normalization, collection-wide counting, minimum frequency, and mean frequency, while cautioning against complex false-positive-prone methods.
Examples
Uses 20 Newsgroups documents, including 121 records containing words used only once.
What it assumes
Assumes text records and basic frequency counting, while demonstrating normalization and empty-record handling.
What you can do after
Diagnose unusual documents by implementing collection-level word counts and comparing minimum, mean, or rare-word frequencies.
How it connects
Connects rare-word frequency with outlier detection, text preprocessing, spelling quality, grammar quality, and topic modeling.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Outlier Detection in Python. The section links point to the parts of the book it draws on.