Skip to content

edsnlp.pipes.ner.scores.base_score

SimpleScoreMatcher [source]

Bases: ContextualMatcher

Matcher component to extract a numeric score

Parameters

PARAMETER DESCRIPTION
nlp

The pipeline object

TYPE: PipelineProtocol

label

The name of the extracted score

TYPE: str DEFAULT: None

regex

A list of regexes to identify the score

TYPE: List[str] DEFAULT: None

attr

Whether to match on the text ('TEXT') or on the normalized text ('NORM')

TYPE: str DEFAULT: NORM

value_extract

Regex with capturing group to get the score value

TYPE: str DEFAULT: None

score_normalization

Function that takes the "raw" value extracted from the value_extract regex and should return:

  • None if no score could be extracted
  • The desired score value else

TYPE: Union[str, Callable[[Union[str, None]], Any]] DEFAULT: None

window

Number of token to include after the score's mention to find the score's value

TYPE: int DEFAULT: 7

ignore_excluded

Whether to ignore excluded spans when matching

TYPE: bool DEFAULT: False

ignore_space_tokens

Whether to ignore space tokens when matching

TYPE: bool DEFAULT: False

flags

Regex flags to use when matching

TYPE: Union[RegexFlag, int] DEFAULT: 0

score_name

Deprecated, use label instead. The name of the extracted score

TYPE: str DEFAULT: None

label

Label name to use for the Span object and the extension

TYPE: str DEFAULT: None

span_setter

How to set matches on the doc

TYPE: Optional[SpanSetterArg] DEFAULT: None

process [source]

Extracts, if available, the value of the score. Normalizes the score via the provided self.score_normalization method.

Parameters

PARAMETER DESCRIPTION
doc

Document to process

TYPE: Doc

YIELDS DESCRIPTION
Span

Matches with, if found, an added score_value extension