udapi.block.transform package

Submodules

udapi.block.transform.deproj module

Block Deproj for deprojectivization of pseudo-projective trees à la Nivre & Nilsson (2005).

See ud.transform.Proj for details. TODO: implement also path and head+path strategies.

class udapi.block.transform.deproj.Deproj(strategy='head', label='misc', **kwargs)[source]

Bases: udapi.core.block.Block

De-projectivize the trees à la Nivre & Nilsson (2005).

head_strategy(node, label)[source]
process_node(node)[source]

Process a UD node

udapi.block.transform.flatten module

transform.Flatten block for flattening trees.

class udapi.block.transform.flatten.Flatten(zones='all')[source]

Bases: udapi.core.block.Block

Apply node.parent = node.root; node.deprel = ‘root’ on all nodes.

process_node(node)[source]

Process a UD node

udapi.block.transform.proj module

Block Proj for (pseudo-)projectivization of trees à la Nivre & Nilsson (2005).

See http://www.aclweb.org/anthology/P/P05/P05-1013.pdf. This block tries to replicate Malt parser’s projectivization: http://www.maltparser.org/userguide.html#singlemalt_proj http://www.maltparser.org/optiondesc.html#pproj-marking_strategy

TODO: implement also path and head+path strategies.

TODO: Sometimes it would be better (intuitively) to lower the gap-node (if its whole subtree is in the gap and if this does not cause more non-projectivities) rather than to lift several nodes whose parent-edge crosses this gap. We would need another label value (usually the lowering is of depth 1), but the advantage is that reconstruction of lowered edges during deprojectivization is simple and needs no heuristics.

class udapi.block.transform.proj.Proj(strategy='head', lifting_order='deepest', label='misc', **kwargs)[source]

Bases: udapi.core.block.Block

Projectivize the trees à la Nivre & Nilsson (2005).

lift(node)[source]
mark(node, label)[source]
nonproj_info(node)[source]
process_tree(tree)[source]

Process a UD tree

Module contents