Term frequency (TF) measures how often a term occurs in a document. It can use a raw count or normalize that count by the document's total number of terms, providing the frequency component of TF-IDF keyword ranking. section 3.2 section 3.2.1
The normalized form divides a term's occurrence count by the document length. section 3.2
Counting a term
If "fox" appears twice in an 18-term document, TF is 2 / 18, approximately 0.1111. The raw-count form is simply 2. section 3.2
A small keyword-search implementation uses TF as follows:
- Tokenize each sentence into words and build an inverted index mapping terms to document identifiers. section 3.2.1
- Count a term with the document token list's count operation. section 3.2.1
- Multiply TF by inverse document frequency, then add matching query-term weights to rank documents. section 3.2.1





