liveBook · Manning

Entity

As explained in Natural Language Processing in Action, Second Edition

An entity is a recognized semantic item in an utterance, such as a location, time expression, person, drug, or crop type.

An entity is a recognized semantic item in language or structured knowledge: a place, time expression, person, drug, crop type, organization, or other named thing. Its role depends on the system: knowledge graphs identify entities as nodes in factual triples, while chatbots extract them as information carried by a user request. section 11.8.1 section 12.2.1

Entity handling commonly involves:

  • Naming entities precisely and consistently, using normalized spellings that can function like database field names or Python variable names. section 11.8.1
  • Representing a knowledge-graph entity in a triple that states one isolated fact about it, such as an entity, relation, and value. section 11.8.1
  • Extracting entities from utterances so a chatbot can use locations, times, durations, distances, or domain-specific items as request parameters. section 12.2.1
  • Distinguishing detected entities from slots: the system may recognize an item such as a person without needing it to execute the requested action. section 12.2.1

Weather request

In “What’s the weather in Paris?” Paris is an entity that supplies the location parameter. In “I’m going to Paris with John this Monday,” Paris and Monday may matter to the forecast, while John can be recognized but ignored because it is not required. section 12.2.1

>>> df = simplify_names(df)               #1
>>> df[df.columns[[0, 1, 2, 4]]].head()
                   entity relation           value   prob
0  aspect_medical_systems     is_a  biotechcompany  0.924
1          limited_brands      ceo   leslie_wexner  0.938
2          limited_brands     is_a     retailstore  0.990
3          limited_brands     is_a         company  1.000
4          calavo_growers     is_a  biotechcompany  0.983

Inspect normalized knowledge-graph entities such as aspect_medical_systems and limited_brands, alongside their relations and values. section 11.8.1

>>> text = 'Ruslan Borisov and Vlad Snisar rebuilt ConvoHub.'
>>> context_diff = extract_proper_nouns(context=dict(user_text=text))
>>> context_diff
{'proper_nouns': ['Ruslan Borisov', 'Vlad Snisar', 'ConvoHub']}

Run proper-noun extraction on an utterance to obtain entities such as Ruslan Borisov, Vlad Snisar, and ConvoHub. section 12.2.1

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains naming, normalization, triples, extraction, and slot distinctions, but stops short of general entity-linking methods.
Examples
Uses NELL triples, normalized names, weather locations and times, drug and crop types, and extracted proper names.
What it assumes
Assumes basic familiarity with language processing and databases while defining entities through concrete utterances and triples.
What you can do after
Apply entity representations to inspect knowledge-graph records and extract actionable parameters from chatbot utterances.
How it connects
Connects entities with knowledge graphs, relations, values, named entity recognition, intents, and slots.

Also explained in

Compare how 12 books explain entity →

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.