Reputation: 11
This relates to the Spacy entity linking library: https://github.com/egerber/spaCy-entity-linker
When I use the following code:
# python -m spacy_entity_linker "download_knowledge_base"
import spacy
nlp = spacy.load("en_core_web_md")
nlp.add_pipe("entity_linker", last=True)
doc = nlp("I watched the Pirates of the Caribbean last silvester")
all_linked_entities = doc._.linkedEntities
for sent in doc.sents:
sent._.linkedEntities.pretty_print()
I get: ValueError: [E139] Knowledge base for component 'entity_linker' is empty. Use the methods kb.add_entity
and kb.add_alias
to add entries.
I might need to add the downloaded knowledge base somewhere but it is nowhere stated.
The original code states that add.pipe should be (entity linking has a different name):
nlp.add_pipe("entityLinker", last=True)
But then i get the error:
ValueError: [E002] Can't find factory for 'entityLinker' for language English (en). This usually happens when spaCy calls nlp.create_pipe
with a custom component name that's not registered on the current language class
Where are things going wrong?
installed the correct libraries
# pip install spacy-entity-linker
# python -m spacy_entity_linker "download_knowledge_base"
also have Spacy, the language model, python 3.8.
Upvotes: 0
Views: 439