src.dackar.pipelines.SimpleEntityMatcher ======================================== .. py:module:: src.dackar.pipelines.SimpleEntityMatcher Attributes ---------- .. autoapisummary:: src.dackar.pipelines.SimpleEntityMatcher.logger Classes ------- .. autoapisummary:: src.dackar.pipelines.SimpleEntityMatcher.SimpleEntityMatcher Functions --------- .. autoapisummary:: src.dackar.pipelines.SimpleEntityMatcher.create_simple_matcher_component Module Contents --------------- .. py:data:: logger .. py:function:: create_simple_matcher_component(nlp, name, label, terms, asSpan) .. py:class:: SimpleEntityMatcher(nlp, label, terms, asSpan=True, callback=None) Bases: :py:obj:`object` How to use it: .. code-block:: python from SimpleEntityMatcher import SimpleEntityMatcher nlp = spacy.load("en_core_web_sm") terms = [{"LOWER": "hello"}, {"IS_PUNCT": True}, {"LOWER": "world"}] pmatcher = SimpleEntityMatcher(nlp, 'ssc', terms) 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: .. code-block:: python nlp.add_pipe('simple_entity_matcher', config={"label": "ssc", "terms":[{"LOWER": "hello"}, {"IS_PUNCT": True}, {"LOWER": "world"}], "asSpan":True}) newDoc = nlp(doc.text) .. py:attribute:: name :value: 'simple_entity_matcher' .. py:attribute:: matcher .. py:attribute:: asSpan :value: True .. py:method:: __call__(doc, replace=False) :param doc: spacy.tokens.doc.Doc, the processed document using nlp pipelines :param replace: if True, relabel duplicated entity with new label :type replace: bool