Skip to content

edsnlp.pipelines.core.contextual_matcher.factory

DEFAULT_CONFIG = dict(attr='NORM', ignore_excluded=False, regex_flags=0, alignment_mode='expand', assign_as_span=False, include_assigned=False) module-attribute

create_component(nlp, name, patterns, assign_as_span, alignment_mode, attr, ignore_excluded, regex_flags, include_assigned)

Source code in edsnlp/pipelines/core/contextual_matcher/factory.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@deprecated_factory(
    "contextual-matcher", "eds.contextual-matcher", default_config=DEFAULT_CONFIG
)
@Language.factory("eds.contextual-matcher", default_config=DEFAULT_CONFIG)
def create_component(
    nlp: Language,
    name: str,
    patterns: Union[Dict[str, Any], List[Dict[str, Any]]],
    assign_as_span: bool,
    alignment_mode: str,
    attr: str,
    ignore_excluded: bool,
    regex_flags: Union[re.RegexFlag, int],
    include_assigned: bool,
):

    return ContextualMatcher(
        nlp,
        name,
        patterns,
        assign_as_span,
        alignment_mode,
        attr=attr,
        ignore_excluded=ignore_excluded,
        regex_flags=regex_flags,
        include_assigned=include_assigned,
    )