Term Frequency › Raw Term Frequency
Language AI HandbookAll chapters Term Frequency › Raw Term FrequencyOne section · Sections in this chapter3 / 17 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
The simplest possible definition of term frequency uses the raw count directly. Raw TF answers the question: "How many times does this term appear in this document?"
where:
- : the raw term frequency weight for term in document
- : the number of times term appears in document
This is exactly what you get from the Bag of Words vectorizer: each entry in the document vector is the number of times the corresponding word appears in the document.
Raw counts are intuitive and fast to compute. They preserve the full information in the term occurrences, which means they can distinguish between a document that mentions "algorithm" twice and one that mentions it twenty times. For some applications, this direct proportionality is exactly what you want. Imagine counting how many times a legal document mentions a specific clause or how many times a customer review mentions "refund." In those cases, absolute counts are the signal.
When to use it: Raw counts are appropriate when your downstream task is insensitive to document length, or when all documents in your corpus are roughly the same length. They're also a natural fit when you want to weight by absolute frequency, such as counting how many times a specific keyword appears in a legal contract to flag potential issues, or when building features for a system where document length is itself a signal you want to preserve.
Limitation: As described above, raw counts suffer from length bias. They also allow very high-frequency terms to dominate the representation. The word "the" might appear 50 times in an essay, drowning out more meaningful terms that appear only a handful of times. Without normalization, your document vectors will be heavily influenced by stopwords and will conflate short focused documents with long discursive ones.