Extract entities
Tip
See the Text and images tab for more details!
Named Entity Recognition identifies entities that are mentioned in the text. Entities are grouped into categories and subcategories, for example:
- Person
- Location
- DateTime
- Organization
- Address
- URL
Note
For a full list of categories, see the documentation.
Input for entity recognition is similar to input for other Azure Language API functions:
# Example text to analyze
documents = ["Microsoft was founded on April 4, 1975 by Bill Gates and Paul Allen in Albuquerque, New Mexico.",
"Satya Nadella became CEO of Microsoft on February 4, 2014."]
# Extract named entities
response = client.recognize_entities(documents=documents)
for doc in response:
print(f"Entities in document {doc.id}:")
for entity in doc.entities:
print(f" - {entity.text} ({entity.category})")
The response includes a list of categorized entities found in each document:
Entities in document 0:
- Microsoft (Organization)
- April 4, 1975 (DateTime)
- Bill Gates (Person)
- Paul Allen (Person)
- Albuquerque (Location)
- New Mexico (Location)
Entities in document 1:
- Satya Nadella (Person)
- CEO (PersonType)
- Microsoft (Organization)
- February 4, 2014. (DateTime)