Reputation: 1
I'm using Spacy 3.7 to add a custom NER model to identify a new entity type ("MYEVENT") while keeping identification of all other entity types (eg: 'EVENT', 'DATE', 'PERSON', 'GPE', etc) intact. I followed the process as described by the Spacy documentation and multiple youtube videos to build the custom NER model. The new model works fine and identifies the 'MYEVENT' entities. However, when I put it into a pipeline to ensure that the other entity types are recognized, I get this error: ValueError: [E109] Component 'w_events_ner' could not be run. Did you forget to call initialize()
?
After building the NER model using the CLI approach defined by
import spacy
nlp_W = spacy.load('en_core_web_sm')
print(nlp_W.pipe_names)
new_vocab = ["MYEVENT"] # New entity types for the model
for item in new_vocab:
nlp_W.vocab.strings.add(item)
w_events_mdl = spacy.load('./output/model-last')
w_events_ner = w_events_mdl.get_pipe("ner")
nlp_W.add_pipe('ner',name='w_events_ner', before='ner')
print(nlp_W.pipe_names)
doc = nlp_W("This is my problem statement") # <<< Error occurs on this statement
The first print statement shows: ['tok2vec', 'tagger', 'parser', 'attribute_ruler', 'lemmatizer', 'ner']
The second print statement shows: ['tok2vec', 'tagger', 'parser', 'attribute_ruler', 'lemmatizer', 'w_events_ner', 'ner']
The 'doc = nlp_W..." shows:
ValueError: [E109] Component 'w_events_ner' could not be run. Did you forget to call initialize()
?
Any help is greatly appreciated!!
Upvotes: 0
Views: 39