Skip to content

edsnlp.utils.bindings

AttributesArg

Valid values for the attributes argument of a component can be :

  • a (span) -> attribute callable
  • a attribute name ("_.negated")
  • a list of attribute names ([".negated", ".event"])
  • a dict of attribute name to True or list of labels, to filter the attributes

Examples

  • attributes="_.negated" will use the negated extention of the span
  • attributes=["_.negated", "_.past"] will use the negated and past extensions of the span
  • attributes={"_.negated": True, "_.past": "DATE"} will use the negated extension of any span, and the past extension of spans with the DATE label

make_binding_getter

Make a attribute getter

Parameters

PARAMETER DESCRIPTION
attribute

Either one of the following: - a path to a nested attributes of the span, such as "attribute_" or "_.negated" - a tuple of (key, value) equality, such as ("_.date.mode", "PASSED")

TYPE: Union[str, Binding]

RETURNS DESCRIPTION
Callable[[Span], bool]

The attribute getter

make_binding_setter

Make a attribute setter

Parameters

PARAMETER DESCRIPTION
binding

A pair of - a path to a nested attributes of the span, such as attribute_ or _.negated - a value assignment

TYPE: Binding

RETURNS DESCRIPTION
Callable[[Span]]

The attribute setter