src.dackar.pipelines.TemporalEntity =================================== .. py:module:: src.dackar.pipelines.TemporalEntity Classes ------- .. autoapisummary:: src.dackar.pipelines.TemporalEntity.Temporal Functions --------- .. autoapisummary:: src.dackar.pipelines.TemporalEntity.find_temporal Module Contents --------------- .. py:function:: find_temporal(nlp, name) .. py:class:: Temporal(nlp) Bases: :py:obj:`object` How to use it: .. code-block:: python from TemporalEnity import Temporal nlp = spacy.load("en_core_web_sm") pmatcher = Temporal(nlp) 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('Temporal') newDoc = nlp(doc.text) .. py:attribute:: name :value: 'Temporal' .. py:attribute:: ordinalToNumber .. py:attribute:: datePattern :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ # Day-Month-Year (?: \d{1,2}(?:st|nd|rd|th)? # Day with optional st, nd, rd, th suffix \s+ (?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]* # Month name (?: # Year is optional \s+ \d{4} # Year )? ) | # Day/Month/Year (?: \d{1,2} # Day [/-] \d{1,2} # Month (?: # Year is optional [/-] \d{2,4} # Year )? ) | # Year-Month-Day (?: \d{4} # Year [-/] \d{1,2} # Month [-/] \d{1,2} # Day ) | # Month-Day-Year (?: (?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]* # Month name \s+ \d{1,2}(?:st|nd|rd|th)? # Day with optional st, nd, rd, th suffix (?: # Year is optional ,? \s+ \d{4} # Year )? ) | # Month-Year (?: (?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]* # Month name \s+ \d{4} # Year ) | # Ordinal-Day-Month-Year (?: \b(?:)\b \s+ (?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]* # Month name (?: # Year is optional \s+ \d{4} # Year )? ) | (?: \b(?:)\b \s+ of \s+ (?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]* # Month name (?: # Year is optional \s+ \d{4} # Year )? ) | # Month Ordinal (?: (?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]* # Month name \s+ \b(?:)\b (?: # Year is optional \s+ \d{4} # Year )? ) | (?: \d+ (?:\-|\s+)? (?:)\b ) """ .. raw:: html
.. py:attribute:: matcher .. py:attribute:: asSpan :value: True .. py:method:: __call__(doc) :param doc: spacy.tokens.doc.Doc, the processed document using nlp pipelines