udapi.block.util.see module

Block util.See prints statistics about the nodes matching a given condition.

Example usage from the command line:

udapy util.See node=’node.is_nonprojective()’ n=3 stats=dir,children,c_upos,p_lemma,deprel,feats_split < in.conllu

Example output:

node.is_nonprojective() matches 245 out of 35766 nodes (0.7%) in 174 out of 1478 trees (11.8%) === dir (2 values) ===

right 193 78% delta=+37%

left 52 21% delta=-33%

=== children (9 values) ===

0 64 26% delta=-38% 2 58 23% delta=+14% 3 38 15% delta= +7%

=== c_upos (15 values) ===
NOUN 118 23% delta= +4%

DET 61 12% delta= -3%

PROPN 47 9% delta= +1%

=== p_lemma (187 values) ===

il 5 2% delta= +1%

fonction 4 1% delta= +1%

écrire 4 1% delta= +1%

=== deprel (22 values) ===
appos 41 16% delta=+15%

conj 41 16% delta=+13%

punct 36 14% delta= +4%

=== feats_split (20 values) ===

Number=Sing 114 21% delta= +2% Gender=Masc 81 15% delta= +3%

_ 76 14% delta= -6%

In addition to absolute counts for each value, the percentage within matching nodes is printed and a delta relative to percentage within all nodes. This helps to highlight what is special about the matching nodes.

class udapi.block.util.see.See(node, n=5, stats='dir,edge,depth,children,siblings,p_upos,p_lemma,c_upos,form,lemma,upos,deprel,feats_split', **kwargs)[source]

Bases: Block

Print statistics about the nodes specified by the parameter node.

process_end()[source]

A hook method that is executed after processing all UD data

process_node(node)[source]

Process a UD node

process_tree(root)[source]

Process a UD tree