Universe

spacy-lookup

A powerful entity matcher for very large dictionaries, using the FlashText module

spaCy v2.0 extension and pipeline component for adding Named Entities metadata to Doc objects. Detects Named Entities using dictionaries. The extension sets the custom Doc, Token and Span attributes ._.is_entity, ._.entity_type, ._.has_entities and ._.entities. Named Entities are matched using the python module flashtext, and looked up in the data provided by different dictionaries.

Example

import spacy from spacy_lookup import Entity nlp = spacy.load('en') entity = Entity(keywords_list=['python', 'java platform']) nlp.add_pipe(entity, last=True) doc = nlp(u"I am a product manager for a java and python.") assert doc._.has_entities == True assert doc[2:5]._.has_entities == True assert doc[0]._.is_entity == False assert doc[3]._.is_entity == True print(doc._.entities)
Author info

Marc Puig

GitHubmpuig/spacy-lookup

Categories pipeline

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