liveBook · Manning

Corpus

As explained in Natural Language Processing in Action, Second Edition

A corpus is a structured collection of documents or language samples used for linguistic analysis or model development.

A corpus is a structured collection of documents or language samples. Counting words across its documents reveals patterns that support linguistic analysis and model development. section 1.5.3

A corpus can support a simple statistical workflow:

  • Decode character groups with a Morse or ASCII table. section 1.5.3
  • Count words or short sequences and record the documents where they occur. section 1.5.3
  • Use the resulting counts as statistical vectors, while recognizing that binning loses information about language. section 1.5.3

Counting words

Counter("Guten Morgen Rosa".split()) produces counts for Guten, Morgen, and Rosa; punctuation and capitalization affect the separate counts in "Good morning Rosa!". section 1.5.3

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Defines document collection, indexing, counting, and vectorization, while deferring deeper language-model mechanics to Word2Vec.
Examples
Uses German and English greeting messages, document indexes, token-sorting analogies, and Python Counter outputs.
What you can do after
Apply it via word counts and document indexes to inspect recurring language patterns.
How it connects
Connects corpora with lexicons, ASCII decoding, statistical vectors, and Word2Vec.

Also explained in

Compare how 4 books explain corpus →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.