loads()
Parse CANE model output and ground every record in text.
Usage
loads(
output,
*,
text,
variant=None,
labels=None,
match="exact",
anchor_fallback=False,
strip_list_markers=False,
handles=False,
prefer_whole_words=False,
dialect=ENGLISH,
options=None,
id=None
)Problems in the model output never raise: they are returned as result.issues. NONE (optionally after the header) or the header alone means no entities; an empty output also gives no entities but is reported as empty_output, because it usually means the generation failed.
Parameters
output: str-
The model’s CANE output, exactly as received.
text: str-
The source text the model annotated.
variant: Variant | str | None = None-
The CANE variant the model was asked for; lines that break it are issues.
labels: Iterable[str] | None = None-
The allowed labels; an unknown label keeps the entity and adds an issue.
match: Match = "exact"-
"exact","normalized"(Unicode NFC) or"casefold". Only this level is used. Whitespace runs always match any whitespace run. anchor_fallback: bool = False-
Ground the bare part when its anchor is not found.
strip_list_markers: bool = False-
Remove leading list markers (
-,1.) from lines. handles: bool = False-
Records carry handles (
T1 `x` is a L), which become entity IDs. prefer_whole_words: bool = False-
When a part could be placed at several occurrences, try those that neither start nor end inside a word (between two letters or digits) first, then the rest, each in reading order. Nothing is ever rejected. Matters mainly for Base and Disco, where no anchor picks the occurrence: in “against Northamptonshire at Northampton”,
`Northampton`then lands on the whole word. dialect: Dialect = ENGLISH-
The surface vocabulary.
options: ParseOptions | None = None-
All of the above as one ParseOptions; excludes the other keywords.
id: str | None = None- The ID of the resulting document (e.g. needed to write it as brat).