parse_conll()

Build documents from CoNLL content.

Usage

Source

parse_conll(
    content, *, scheme="bio", repair=False, text=None, comment_prefix=None
)

Parameters

content: str

The file content.

scheme: Scheme = "bio"

The tag scheme: "bio" (IOB2), "iob1", "bioes" or "bilou".

repair: bool = False

Accept invalid tag sequences (e.g. I-X after O) by starting a new entity there, instead of raising.

text: str | None = None

The true raw text, if known. Tokens are aligned onto it (only whitespace may lie between them) and offsets refer to it. Only for content with exactly one document.

comment_prefix: str | None = None
Treat lines starting with this prefix (e.g. "#") as comments. A comment doc_id = X or newdoc id = X starts a new document with ID X; other comments are kept in metadata["conll_comments"]. Off by default, since # can also be a token.