Open wellington36 opened 3 years ago
node.draw()
prints a subtree rooted in node
. With the default setting print_text=True
, also the # text
value represents only the word forms of the subtree, not the whole tree.
In your case, you printed the subtree rooted in "normas", but the comma between "e" and "inversa" is not part of the subtree. The node "e" has SpaceAfter=No
in the MISC column, so it is printed without any space after the token. I admit, it may be better if SpaceAfter=No
is ignored when printing a subtree and when there is a "gap" - a PR is welcome.
It may be better for your purposes, if you just print the whole tree with a given node (i.e. the ADJ node, not its grandparent) highlighted:
cat *.conllu | udapy -TMA util.Mark node='node.upos == "ADJ" and node.deprel == "amod" and node.parent.upos == "NOUN" and (node.feats["Gender"] != node.parent.feats["Gender"] or node.feats["Number"] != node.parent.feats["Number"])' | less -R
Another solution would be to keep using util.Eval
, but print the whole tree with node.root.draw()
.
You can additionally highlight any node with node.misc["Mark"]=1
(which is what is done internally in util.Mark), but util.Eval
uses Python eval()
which takes a single Python expression. So you would need to convert the solution from util.Eval one-liner to a full Udapi block.
Thank you @martinpopel for your detailed explanation. @wellington36 is working with me, hope at some point he can eventually collaborate with udapi.
When running the following command
From the output we get
However, the "text" value is not part of the respective conllu
Udapy replaced "e, inversa" for "eiversa".