liveBook · Manning

Word count

Also called number of words

A metric that counts word units in text, either overall or for a specified word, according to the applicable segmentation rule.

How 2 Manning books explain it

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
Uses word counts for file statistics and word-frequency analysis.
How deep it goes
Works through whitespace counting, alphabetic filtering, frequency dictionaries, and memory trade-offs.
Examples
Uses a sample text file for line, word, and character counts and a Moby Dick excerpt for word frequencies.
What you can do after
Builds a word counter from scratch and adapts it for word frequencies or command-line file statistics.

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 →

Also covered in

What to know first

Related concepts

Questions about word count

What is word count?

A metric that counts word units in text, either overall or for a specified word, according to the applicable segmentation rule.

Which Manning books explain word count?

The Quick Python Book, Fourth Edition and Functional Programming in Scala, Second Edition.

What should I know before learning word count?

Manning books that teach word count usually introduce plain text and whitespace character first.

What is the difference between word count and token?

A metric that counts word units in text, either overall or for a specified word, according to the applicable segmentation rule. A text token is a discrete unit of text, such as a word, subword, character, or punctuation mark, produced by tokenization and processed as one element by a language model or text-processing system.

What is word count a kind of?

Word count is a kind of package. A software package is an organized unit of related software components, defined by a programming language or package ecosystem for grouping, naming, building, importing, or distribution.

What is word count also called?

Word count is also called number of words.

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.