medkit.text.ner.edsnlp_date_matcher#

This module needs extra-dependencies not installed as core dependencies of medkit. To install them, use pip install medkit-lib[edsnlp].

Classes:

EDSNLPDateMatcher([output_label, ...])

Date matcher based on EDS-NPL's dates pipeline which itself relies on regular expressions.

class EDSNLPDateMatcher(output_label='date', attrs_to_copy=None, uid=None)[source]#

Date matcher based on EDS-NPL’s dates pipeline which itself relies on regular expressions. Note that this operation is designed to run on french documents.

Absolute dates (ex: “23/08/2021”), relatives dates (ex: “la semaine dernière”) and durations (ex: “pendant quatre jours”) will be matched.

For each date that is found, an entity will be created with an attribute attached to it containing normalized values of the date components. The attribute label will be either “date” or “duration”, and the class of the attribute will be either class DateAttribute, RelativeDateAttribute or DurationAttribute.

Parameters
  • output_label (str) – Label to use for date entities created (the label of the attributes will always be “date” or “duration”)

  • attrs_to_copy (Optional[List[str]]) – Labels of the attributes that should be copied from the input segment to the created date entity. Useful for propagating context attributes (negation, antecedent, etc).

  • uid (str) – Identifier of the matcher

Methods:

run(segments)

Find and return date entities for all segments

set_prov_tracer(prov_tracer)

Enable provenance tracing.

Attributes:

description

Contains all the operation init parameters.

run(segments)[source]#

Find and return date entities for all segments

Parameters

segments (List[Segment]) – List of segments into which to look for date mentions

Return type

List[Entity]

Returns

entities (List[Entity]) – Date entities found in segments, with DateAttribute, RelativeDateAttribute or DurationAttribute attributes.

property description: medkit.core.operation_desc.OperationDescription#

Contains all the operation init parameters.

Return type

OperationDescription

set_prov_tracer(prov_tracer)#

Enable provenance tracing.

Parameters

prov_tracer (ProvTracer) – The provenance tracer used to trace the provenance.