src.dackar.pipelines.UnitEntity

Attributes

logger

Classes

UnitEntity

How to use it:

Functions

create_unit_component(nlp, name, label, asSpan)

Module Contents

src.dackar.pipelines.UnitEntity.logger[source]
src.dackar.pipelines.UnitEntity.create_unit_component(nlp, name, label, asSpan)[source]
class src.dackar.pipelines.UnitEntity.UnitEntity(nlp, label='unit', asSpan=True, callback=None)[source]

Bases: object

How to use it:

from UnitEntity import UnitEntity
nlp = spacy.load("en_core_web_sm")
unit = UnitEntity(nlp, 'ssc')
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 = unit(doc)

or:

nlp.add_pipe('unit_entity', config={"label": "ssc", "asSpan":True})
newDoc = nlp(doc.text)
name = 'unit_entity'[source]
label[source]
nlp[source]
matcher[source]
asSpan[source]
__call__(doc)[source]
Parameters:

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