Skip to content

edsnlp.pipelines.misc.measurements.factory

DEFAULT_CONFIG = dict(attr='NORM', ignore_excluded=True, units_config=patterns.units_config, number_terms=patterns.number_terms, unit_divisors=patterns.unit_divisors, measurements=None, stopwords=patterns.stopwords) module-attribute

create_component(nlp, name, measurements, units_config, number_terms, stopwords, unit_divisors, ignore_excluded, attr)

Source code in edsnlp/pipelines/misc/measurements/factory.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@Language.factory("eds.measurements", default_config=DEFAULT_CONFIG)
@deprecated_factory("eds.measures", "eds.measurements", default_config=DEFAULT_CONFIG)
def create_component(
    nlp: Language,
    name: str,
    measurements: Optional[Union[Dict[str, MeasureConfig], List[str]]],
    units_config: Dict[str, UnitConfig],
    number_terms: Dict[str, List[str]],
    stopwords: List[str],
    unit_divisors: List[str],
    ignore_excluded: bool,
    attr: str,
):
    return MeasurementsMatcher(
        nlp,
        units_config=units_config,
        number_terms=number_terms,
        unit_divisors=unit_divisors,
        measurements=measurements,
        stopwords=stopwords,
        attr=attr,
        ignore_excluded=ignore_excluded,
    )