xxxxxxxxxx
# Import spacy
import spacy
artice = [ ]
# Instantiate the English model: nlp
nlp = spacy.load('en', tagger=False, parser=False, matcher=False)
# Create a new document: doc
doc = nlp(article)
# Print all of the found entities and their labels
for ents in doc.ents:
print(ents.label_ , ents.text)
xxxxxxxxxx
# Load the required model
nlp = spacy.load('en_core_web_sm')
# Create a Doc instance
text = 'Sundar Pichai is the CEO of Google. Its headquarters is in Mountain View.'
doc = nlp(text)
# Print all named entities and their labels
for ent in doc.ents:
print(ent.text, ent.label_)