TF-IDF Analysis
TF-IDF weights a term by how often it appears in a document against how rare it is across the corpus, surfacing words distinctive to that document rather than ones common everywhere, which powers keyword extraction and search ranking.
WHY IT EXISTS: Raw word counts treat every word equally, so common filler words swamp the signal. TF-IDF exists to separate words that genuinely characterize a document from words that appear everywhere and therefore carry little discriminating meaning about its topic.
THE MENTAL MODEL: Think of two opposing forces. Term frequency says a word matters more if it shows up a lot inside this document. Inverse document frequency says a word matters less if it shows up across many documents in the corpus. The product is high only when a word is both locally frequent and globally rare, which is precisely what makes it a good fingerprint for the document's subject.
HOW IT WORKS: Term frequency is the count of a term in a document, often normalized by document length. Inverse document frequency is the logarithm of the total number of documents divided by the number of documents containing the term, so rare terms get a large multiplier and terms appearing in every document get a multiplier near zero. The final weight is term frequency multiplied by inverse document frequency, computed per term per document, producing a sparse vector you can compare or rank.
WHEN IT MATTERS: It matters for keyword extraction, lightweight search relevance, near-duplicate detection, and especially SEO content analysis, where you compare a draft against the terms that distinguish top-ranking pages for a query, revealing topical gaps you should fill to compete.
ONE CONCRETE EXAMPLE: In an article about espresso, the word 'crema' might appear five times and occur in only a handful of corpus documents, earning a high TF-IDF weight, while 'coffee' appears in nearly every document and is down-weighted despite being frequent. So 'crema' correctly emerges as a distinctive topic term, the kind of word a search engine treats as meaningfully on-topic rather than generic background vocabulary.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.