Extract entities
Unit 4 of 7 · Module 16: Analyze text with Azure Language in Foundry Tools
Read this lesson
Things with names
An entity is a real thing that a text names: a person, a place, a date, a company. Named entity recognition, or NER, finds those words and stamps each one with a category. The common ones are Person, Location, DateTime, Organization, Address, Email and URL. There are plenty more, like PersonType for a role such as guide, and Quantity for amounts. The docs list them all.
Same tray, new question
The input looks just like language detection: a list of documents. This time you call recognize underscore entities. Take two of Wayfarer's notes. Our guide Kenji Watanabe met the group at Kyoto Station at nine in the morning. Wayfarer Trips opened its Lisbon office on the third of May, twenty twenty one, with Inês Carvalho in charge. For each document you loop over its entities, and each one tells you its text and its category. Kenji Watanabe is a Person, guide is a PersonType, Kyoto Station is a Location, and nine in the morning is a DateTime. In the second note, Wayfarer Trips is an Organization and the date is a DateTime. Each entity also has a confidence score, and an offset, the position where it starts in the text.
Putting the stamps to work
Now Wayfarer can do something useful. Keep only the Location entities, and every review gets a list of the places it mentions, ready for the city guides. Mind the limit, though. Entity recognition takes at most five documents per request, far fewer than language detection, so a pile of reviews goes out in batches of five. One more detail: newer versions of the API describe entities with a type field instead of subcategories, so don't build on subcategories. What you'll print in this module is the text and the category.
Facts from Microsoft's documentation: What is named entity recognition (NER) in Azure Language?; How to perform named entity recognition; NER entity categories; Service limits for Azure Language (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.