Entity types help computers find important names like people, places, organizations, and dates in text. This makes understanding and organizing information easier.
0
0
Entity types (PERSON, ORG, LOC, DATE) in NLP
Introduction
When you want to find names of people mentioned in news articles.
When you need to identify company names in emails or reports.
When extracting locations from travel blogs or social media posts.
When recognizing dates in appointment reminders or event descriptions.
When organizing large text data by important categories automatically.
Syntax
NLP
Entity types are labels assigned to words or phrases in text, such as: - PERSON: names of people - ORG: names of organizations or companies - LOC: names of locations like cities or countries - DATE: mentions of dates or times
These labels are used in Named Entity Recognition (NER) tasks in NLP.
Different NLP tools may have slightly different sets of entity types.
Examples
This example shows how each entity type marks a part of the sentence.
NLP
Text: "Alice works at OpenAI in San Francisco since 2020." Entities: - PERSON: Alice - ORG: OpenAI - LOC: San Francisco - DATE: 2020
Here, the organization and date are identified from the sentence.
NLP
Text: "Google was founded in September 1998." Entities: - ORG: Google - DATE: September 1998
Sample Model
This code uses spaCy, a popular NLP library, to find entities and their types in a sentence.
NLP
import spacy # Load small English model with NER nlp = spacy.load('en_core_web_sm') text = "Barack Obama was born in Hawaii on August 4, 1961 and worked at the University of Chicago." # Process the text doc = nlp(text) # Extract entities and their types for ent in doc.ents: print(f'{ent.text}: {ent.label_}')
OutputSuccess
Important Notes
PERSON means a person's name.
ORG means an organization like a company or university.
LOC or GPE means a location or geopolitical place like a city or country.
DATE means any date or time expression.
Summary
Entity types label important words in text to help computers understand meaning.
Common types include PERSON, ORG, LOC (or GPE), and DATE.
These labels are used in many applications like search, chatbots, and data analysis.