Named Entity Recognition (NER) is an information retrieval process. NER helps classify named entities such as monetary figures, location, things, people, time, and more. It allows the software to analyze and understand the meaning of the text. NER is mostly used in NLP, Artificial Intelligence, and Machine Learning. One of the real-life applications of NER is chatbots used for customer support.
Let’s implement NER using the spacy package.
Importing the spacy package:
import spacy
nlp = spacy.load('en_core_web_sm')
Text = "The head office of Google is in California"
document = nlp(text)for ent in document.ents:
print(ent.text, ent.start_char, ent.end_char, ent.label_)
Output:
Office 9 15 Place
Google 19 25 ORG
California 32 41 GPE