spaCy fishing

Named entity disambiguation and linking on Wikidata in spaCy with Entity-Fishing.

A spaCy wrapper of Entity-Fishing for named entity disambiguation and linking against a Wikidata knowledge base.


import spacy text = 'Victor Hugo and Honoré de Balzac are French writers who lived in Paris.' nlp = spacy.load('en_core_web_sm') nlp.add_pipe('entityfishing') doc = nlp(text) for span in doc.ents: print((ent.text, ent.label_, ent._.kb_qid, ent._.url_wikidata, ent._.nerd_score)) # ('Victor Hugo', 'PERSON', 'Q535', 'https://www.wikidata.org/wiki/Q535', 0.972) # ('Honoré de Balzac', 'PERSON', 'Q9711', 'https://www.wikidata.org/wiki/Q9711', 0.9724) # ('French', 'NORP', 'Q121842', 'https://www.wikidata.org/wiki/Q121842', 0.3739) # ('Paris', 'GPE', 'Q90', 'https://www.wikidata.org/wiki/Q90', 0.5652) ## Set parameter `extra_info` to `True` and check also span._.description, span._.src_description, span._.normal_term, span._.other_ids
Author info

Lucas Terriel


Categories models pipeline

Found a mistake or something isn't working?

If you've come across a universe project that isn't working or is incompatible with the reported spaCy version, let us know by opening a discussion thread.

Submit your project

If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the project idea label on the issue tracker.

Read the docsJSON source