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 thenegated
extention of the spanattributes=["_.negated", "_.past"]
will use thenegated
andpast
extensions of the spanattributes={"_.negated": True, "_.past": "DATE"}
will use thenegated
extension of any span, and thepast
extension of spans with theDATE
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 TYPE: |
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 TYPE: |
RETURNS | DESCRIPTION |
---|---|
Callable[[Span]] | The attribute setter |