udapi.block.util.resegmentgold module

util.ResegmentGold is a block for sentence alignment and re-segmentation of two zones.

class udapi.block.util.resegmentgold.ResegmentGold(gold_zone='gold', **kwargs)[source]

Bases: Block

Sentence-align two zones (gold and pred) and resegment the pred zone.

The two zones must contain the same sequence of characters.

static choose_root(p_tree, was_subroot, g_tree)[source]

Prevent multiple roots, which are forbidden in CoNLL-U.

extract_pred_trees(document)[source]

Delete all trees with zone!=gold_zone from the document and return them.

process_document(document)[source]

Process a UD document