Skip to content

edsnlp.pipes.qualifiers.base

BaseTokenQualifierResults dataclass [source]

Base dataclass to store qualification informations for each token. Specific qualifier pipes should inherit from this class and add specific fields as needed

BaseEntQualifierResults dataclass [source]

Base dataclass to store qualification informations for each entity. Specific qualifier pipes should inherit from this class and add specific fields as needed

BaseQualifierResults dataclass [source]

Base dataclass to store qualification informations for all tokens and entities.

RuleBasedQualifier [source]

Bases: BaseSpanAttributeClassifierComponent

Implements the ConText algorithm (eq. NegEx for negations) for detecting contextual attributes text.

Parameters

PARAMETER DESCRIPTION
nlp

The pipeline object.

TYPE: PipelineProtocol

attr

spaCy's attribute to use: a string with the value "TEXT" or "NORM", or a dict with the key 'term_attr' we can also add a key for each regex.

TYPE: str

span_getter

Which entities should be classified. By default, doc.ents

TYPE: SpanGetterArg

on_ents_only

Whether to look for matches around detected entities only. Useful for faster inference in downstream tasks.

  • If True, will look in all ents located in doc.ents only
  • If an iterable of string is passed, will additionally look in doc.spans[key] for each key in the iterable

TYPE: Union[bool, str, List[str], Set[str]]

explain

Whether to keep track of cues for each entity.

TYPE: bool

**terms

Terms to look for.

TYPE: Dict[str, Optional[List[str]]]

get_cues [source]

Extract cues (ex: ne/pas for negations) from the document.

Parameters

PARAMETER DESCRIPTION
doc

The document to process.

TYPE: Doc

spans

Optional list of spans to limit the search around. If None, will search in the whole document.

TYPE: Optional[List[Span]] DEFAULT: None

RETURNS DESCRIPTION
List[Span]

List of detected cues