Use a linguistic tagger to perform named entity recognition on a string.
- Natural Language
Identifying named entities in natural language text can help make your app more intelligent. For example, a messaging app might look for names of people and places in text in order to display related information like contact information or directions.
The example and accompanying steps below show how to use NLTagger to enumerate over natural language text and identify any named person, place, or organization.
Set the string property of the linguistic tagger to the natural language text.
Create the options to omit punctuation, omit whitespace, and join names.
In the enumeration block, if the tag is one of the types in
tags, then take a substring of the original text at tokenRange to obtain the named entity.
Run this code to print out each name and its type on a new line.