One of the most major forms of chunking in natural language processing is called “Named Entity Recognition.” The idea is to automatically be able to pull out “entities” like people, places, things, locations, monetary figures, and more.
The various types of named entities and their codes are listed below for your reference.

All the above entities can be recognized by the Spacy library out of the box!
spaCy is a free, open-source library for advanced Natural Language Processing (NLP) in Python. It helps to perform NLP using pre-trained models. We are going to use one such model called “en_core_web_sm“
More information at : https://spacy.io/models/en#en_core_web_sm
Installing and using Spacy
Installing spacy is a two-step process, first, you install the library, then you install the required model
1 2 3 4 5 |
# installing the spacy library !pip install spacy # installing the spacy NER model !python -m spacy download en_core_web_sm |
Finding Entities in Sentences using Spacy NER
1 2 3 4 5 6 7 8 9 10 11 |
import spacy import en_core_web_sm nlp = spacy.load('en_core_web_sm') SampleSentence = '''Indian ministry collected record $1 billion as taxes on Wednesday, finance minister Sitaraman announced in Delhi''' SampleSentence ='''we will go to Delhi to meet the director of the VCorp, Mr. Ramesh''' #SampleSentence = 'Do you speak Hindi?' FoundEntities=nlp(SampleSentence) for X in FoundEntities.ents: print([(X.text, X.label_)]) |
Sample Output
