liveBook · Manning

Conditional random field

As explained in Natural Language Processing in Action, Second Edition

A conditional random field is a probabilistic structured-prediction model that assigns labels to related observations under conditional dependencies.

A conditional random field (CRF) assigns labels to related observations while using dependencies between them. In named entity recognition, context from words before and after an entity helps distinguish boundaries and types, such as whether “Washington” denotes a person, location, organization, or sports team. section 11.4.2

CRFs work here as the final technique combined with bidirectional LSTMs in spaCy’s NER module. The surrounding pipeline also relies on part-of-speech tagging and dependency parsing to identify entities and their relationships for knowledge graphs. section 11.4.2

Inspecting spaCy entities

Run spaCy on text and inspect the resulting document’s ents attribute to retrieve recognized entities, without implementing the neural network or CRF yourself. section 11.4.2

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains contextual purpose and pipeline placement, but does not derive CRF mathematics or implementation internals.
Examples
Uses ambiguous Washington entities and spaCy’s doc.ents output to illustrate contextual recognition.
What it assumes
Assumes basic NLP familiarity with tokens and labels while presenting entity extraction through spaCy’s interface.
What you can do after
Apply it via spaCy to extract named entities without building the underlying neural network.
How it connects
Connects CRFs with named entity recognition, bidirectional LSTMs, neural networks, POS tagging, dependency parsing, and knowledge graphs.

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.