edsnlp.pipes.core.contextual_matcher.models
SingleExcludeModel [source]
Bases: BaseModel
A dictionary to define exclusion rules. Exclusion rules are given as Regexes, and if a match is found in the surrounding context of an extraction, the extraction is removed. Note that only take a match into account if it is not inside the anchor span.
Parameters
| PARAMETER | DESCRIPTION |
|---|---|
regex | A single Regex or a list of Regexes TYPE: |
regex_attr | An attributes to overwrite the given TYPE: |
regex_flags | Regex flags TYPE: |
span_getter | A span getter to pick the assigned spans from already extracted entities. TYPE: |
window | Context window to search for patterns around the anchor. Defaults to "sent" ( i.e. the sentence of the anchor span). TYPE: |
SingleIncludeModel [source]
Bases: BaseModel
A dictionary to define inclusion rules. Inclusion rules are given as Regexes, and if a match isn't found in the surrounding context of an extraction, the extraction is removed. Note that only take a match into account if it is not inside the anchor span.
Parameters
| PARAMETER | DESCRIPTION |
|---|---|
regex | A single Regex or a list of Regexes TYPE: |
regex_attr | An attributes to overwrite the given TYPE: |
regex_flags | Regex flags TYPE: |
span_getter | A span getter to pick the assigned spans from already extracted entities. TYPE: |
window | Context window to search for patterns around the anchor. Defaults to "sent" ( i.e. the sentence of the anchor span). TYPE: |
ExcludeModel
Bases: AsList[SingleExcludeModel]
A list of SingleExcludeModel objects. If a single config is passed, it will be automatically converted to a list of a single element.
IncludeModel
Bases: AsList[SingleIncludeModel]
A list of SingleIncludeModel objects. If a single config is passed, it will be automatically converted to a list of a single element.
SingleAssignModel [source]
Bases: BaseModel
A dictionary to refine the extraction. Similarly to the exclude key, you can provide a dictionary to use on the context before and after the extraction.
Parameters
| PARAMETER | DESCRIPTION |
|---|---|
span_getter | A span getter to pick the assigned spans from already extracted entities in the doc. TYPE: |
regex | A single Regex or a list of Regexes TYPE: |
regex_attr | An attributes to overwrite the given TYPE: |
regex_flags | Regex flags TYPE: |
window | Context window to search for patterns around the anchor. Defaults to "sent" ( i.e. the sentence of the anchor span). TYPE: |
replace_entity | If set to TYPE: |
reduce_mode | Set how multiple assign matches are handled. See the documentation of the TYPE: |
required | If set to TYPE: |
name | A name (string) TYPE: |
AssignModel
Bases: AsList[SingleAssignModel]
A list of SingleAssignModel objects that should have at most one element with replace_entity=True. If a single config is passed, it will be automatically converted to a list of a single element.
SingleConfig [source]
Bases: BaseModel
A single configuration for the contextual matcher.
Parameters
| PARAMETER | DESCRIPTION | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
span_getter | A span getter to pick the assigned spans from already extracted entities in the doc. TYPE: | ||||||||||||||||||
regex | A single Regex or a list of Regexes TYPE: | ||||||||||||||||||
regex_attr | An attributes to overwrite the given TYPE: | ||||||||||||||||||
regex_flags | Regex flags
| ||||||||||||||||||
terms | A single term or a list of terms (for exact matches) TYPE: | ||||||||||||||||||
exclude | One or more exclusion patterns
TYPE: | ||||||||||||||||||
include | One or more inclusion patterns
TYPE: | ||||||||||||||||||
assign | One or more assignment patterns
TYPE: | ||||||||||||||||||
source | A label describing the pattern TYPE: |
FullConfig
Bases: AsList[SingleConfig]
A list of SingleConfig objects that should have distinct source fields. If a single config is passed, it will be automatically converted to a list of a single element.