src.dackar.pipelines.PhraseEntityMatcher

Attributes

logger

Classes

PhraseEntityMatcher

How to use it:

Functions

create_phrase_matcher_component(nlp, name, label, ...)

Module Contents

src.dackar.pipelines.PhraseEntityMatcher.logger[source]
src.dackar.pipelines.PhraseEntityMatcher.create_phrase_matcher_component(nlp, name, label, terms, asSpan)[source]
class src.dackar.pipelines.PhraseEntityMatcher.PhraseEntityMatcher(nlp, label, terms, asSpan=True, callback=None)[source]

Bases: object

How to use it:

from PhraseEntityMatcher import PhraseEntityMatcher
nlp = spacy.load("en_core_web_sm")
phraseList = ["safety cage", "cage", "pump"]
pmatcher = PhraseEntityMatcher(nlp, 'ssc', phraseList)
doc = nlp("The shaft deflection is causing the safety cage to rattle. Pumps not experiencing enough flow for the pumps to keep the check valves open during test. Pump not experiencing enough flow during test. Shaft made noise. Vibration seems like it is coming from the shaft.")
updatedDoc = pmatcher(doc)

or:

nlp.add_pipe('phrase_entity_matcher', config={"label": "ssc", "terms":["safety cage", "pump"], "asSpan":True})
newDoc = nlp(doc.text)
name = 'phrase_entity_matcher'[source]
matcher[source]
patterns[source]
asSpan[source]
__call__(doc)[source]
Parameters:

doc – spacy.tokens.doc.Doc, the processed document using nlp pipelines