parse_brat()

Build a document from the contents of a .txt and an .ann file.

Usage

Source

parse_brat(
    text,
    ann,
    *,
    id=None,
    verify="raise",
    offset_unit="codepoint",
)

Parameters

text: str

The .txt content, unchanged (read with newline='').

ann: str

The .ann content.

id: str | None = None

The document ID, usually the file stem.

verify: Verify = "raise"

Check every text-bound annotation against its stored text: "raise" an IntegrityError on mismatch, "warn", or "off".

offset_unit: OffsetUnit = "codepoint"
The unit the offsets count in.