Skip to content

Alignment

bcql_py.models.alignment

Alignment queries use the ==> operator to find cross-field alignments between versions of a parallel corpus (e.g. English -> Dutch).

Similar to models/relation but with different operators and semantics.

AlignmentOperator

Bases: BCQLNode

The operator in an alignment query: =type=>field or ==>field?.

See https://github.com/instituutnederlandsetaal/BlackLab/blob/dev/site/docs/guide/040_query-language/030_parallel.md

Attributes:

Name Type Description
target_field str

The target field name (e.g. "nl").

optional bool

True when alignment is optional (==>nl?).

relation_type str | None

Optional type filter (e.g. "word" in =word=>nl). None means any alignment relation

capture_name str | None

Override for the capture group name (default "rels"). Set by name:==>field syntax

AlignmentConstraint

Bases: BCQLNode

One alignment constraint: operator target

Multiple alignment constraints are separated by ;.

Attributes:

Name Type Description
operator AlignmentOperator
target BCQLNodeUnion

The target sub-query.

AlignmentNode

Bases: BCQLNode

A parallel alignment query: source ==>field target [; ==>field target]*. Attributes: source: The source query in the primary field alignments: One or more alignment constraints.