Question : spacy ner
Answered by : adhun-thalekkara
import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("NASA awarded Elon Musk’s SpaceX a $2.9 billion contract to build the lunar lander.")
for ent in doc.ents: print(ent.text, ent.label_)
Source : https://machinelearningknowledge.ai/named-entity-recognition-ner-in-spacy-library/ | Last Update : Fri, 22 Jul 22
Question : ner spacy
Answered by : adhun-thalekkara
# Construction via add_pipe with default model
ner = nlp.add_pipe("ner")
# Construction via add_pipe with custom model
config = {"model": {"@architectures": "my_ner"}}
parser = nlp.add_pipe("ner", config=config)
# Construction from class
from spacy.pipeline import EntityRecognizer
ner = EntityRecognizer(nlp.vocab, model)
Source : https://spacy.io/api/entityrecognizer | Last Update : Fri, 22 Jul 22