Word count
A metric that counts word units in text, either overall or for a specified word, according to the applicable segmentation rule.
The Quick Python Book, Fourth Edition
A word count is the number of words identified in a text according to a specified word-segmentation rule.
- How it is used
- Measures words in a file alongside line and character counts, or counts occurrences of individual words.
- How deep it goes
- Works through split-based counting, line-by-line accumulation, alphabetic filtering, and dictionary frequencies without defining a universal word boundary.
- Examples
- Uses a four-line sample reporting 30 words and a cleaned text file ranked by most and least common words.
- What you can do after
- Build it from scratch as a Python file counter, then adapt it for alphabetic-only counts or per-word frequencies.
Read how The Quick Python Book, Fourth Edition explains word count →
Functional Programming in Scala, Second Edition
The number of whitespace-delimited words represented by a character sequence or word-count summary.
- How it is used
- Motivates monoidal parallel parsing by showing why split substrings require richer results than integer counts.
- How deep it goes
- Derives a `WC` algebraic data type, all four combine cases, law tests, and a character-folding implementation.
- Examples
- Works through splitting "lorem ipsum dolor sit amet, " inside "dolor" and combines the resulting `Part` values.
- What you can do after
- Build it from scratch by defining a lawful `WC` monoid and folding whitespace-classified characters into a final count.
Read how Functional Programming in Scala, Second Edition explains word count →
Related concepts
- tokencontrasts with · A token is a discrete unit of text, such as a word, word fragment, character, or symbol, represented and processed as an element by a language model.
- packagekind of · A software package is a named grouping of modules or components, often with related resources and metadata, organized for import, reuse, distribution, or management.
- wc utilitymeasured by · The wc utility is a Unix command-line tool that reports counts of lines, words, bytes, characters, and related properties in files or input streams.
- functionproduced by · A function is a callable program unit that performs an operation, may accept inputs, and can produce a result or side effect.
- classifieruses · A classifier is a predictive computational model that assigns inputs to one or more discrete classes or categories.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

