egerber / spaCy-entity-linker

spaCy module for linking text to Wikidata items
MIT License
215 stars 32 forks source link

example in README doesn't work #1

Closed personx000 closed 3 years ago

personx000 commented 3 years ago

Hi - this is a really interesting project - thanks for making it available. However, the basic example in the README doesn't work with a fresh install (i.e., spacy==2.3.5 and spacy-entity-linker==0.0.5):

doc = nlp("I watched the Pirates of the Carribean last silvester")
all_linked_entities=doc._.linkedEntities
for sent in doc.sents:
    sent._.linkedEntities.pretty_print()

returns the following and resolves Pirates of Carribean to Pittsburgh Pirates:

https://www.wikidata.org/wiki/Q653772     653772     Pittsburgh Pirates              baseball team and Major League Baseball franchise in Pittsburgh, Pennsylvania, United States        
https://www.wikidata.org/wiki/Q12525597   12525597   Silvester                       the day celebrated on 31 December (Roman Catholic Church) or 2 January (Eastern Orthodox Churches) 
montis96 commented 3 years ago

I used the spacy == 2.2.4 version and it seems work

luigi-asprino commented 3 years ago

same here. I also tried 2.2.4 version but still gives me wrong results

https://www.wikidata.org/wiki/Q653772     653772     Pittsburgh Pirates              baseball team and Major League Baseball franchise in Pittsburgh, Pennsylvania, United States        
https://www.wikidata.org/wiki/Q12525597   12525597   Silvester                       the day celebrated on 31 December (Roman Catholic Church) or 2 January (Eastern Orthodox Churches)  
egerber commented 3 years ago

@personx000 @luigi-asprino Sorry for not reacting to your posts. I did not actively work on this repo for a while.

There was indeed an error in the provided example. It should have been Pirates of the Caribbean for the input text (instead of Carribean). One of the problems with exact string matching... :D

I updated the example and also created a new major release for spacy version 3 (thanks to @MartinoMensio)