Way to modify nodes
We are currently working on a conversion of a treebank to UD.
Input:
# sent_id = DW-s41
# text = Tiqsimuyu -pi medio -pi willa -y apa -y -manta waynakuna -paq yachaysi -y .
1 Tiqsimuyu _ Root Root NRoot 2 s.arg _ Gloss=globo,tierra,mundo
2 -pi _ Cas Cas +Loc 4 co _ _
3 medio _ Root Root NRootES 4 s.arg _ _
4 -pi _ Cas Cas +Loc 12 mod _ _
5 willa _ Root Root VRoot 7 obj _ Gloss=contar
6 -y _ NS NS +Inf 5 ns _ _
7 apa _ Root Root VRoot 9 s.arg.claus _ Gloss=llevar
8 -y _ NS NS +Inf 7 ns _ _
9 -manta _ Cas Cas +Abl 12 mod _ _
10 waynakuna _ Root_Num Root_Num NRoot|+Pl 11 s.arg _ Gloss=joven
11 -paq _ Cas Cas +Ben 12 ben _ _
12 yachaysi _ Root_VDeriv Root_VDeriv VRoot|+Ass 0 sntc _ Gloss=saber,habitar
13 -y _ NS NS +Inf 12 ns _ _
14 . _ $. $. _ 0 punc _ _
Rule file:
rule main {
pattern {
V [cat=Root];
NS [cat=NS];
ns: V -[ns]-> NS;
}
commands {
del_edge ns ;
}
}
Output:
$ cat test.conllu | grew transform -grs merge.grs
100.00%
# sent_id = DW-s41_0
# text = Tiqsimuyu -pi medio -pi willa -y apa -y -manta waynakuna -paq yachaysi -y .
1 Tiqsimuyu _ Root Root NRoot=true 2 s.arg _ Gloss=globo,tierra,mundo
2 -pi _ Cas Cas +Loc=true 4 co _ _
3 medio _ Root Root NRootES=true 4 s.arg _ _
4 -pi _ Cas Cas +Loc=true 12 mod _ _
5 willa _ Root Root VRoot=true 7 obj _ Gloss=contar
6 -y _ NS NS +Inf=true _ _ _ _
7 apa _ Root Root VRoot=true 9 s.arg.claus _ Gloss=llevar
8 -y _ NS NS +Inf=true 7 ns _ _
9 -manta _ Cas Cas +Abl=true 12 mod _ _
10 waynakuna _ Root_Num Root_Num +Pl=true|NRoot=true 11 s.arg _ Gloss=joven
11 -paq _ Cas Cas +Ben=true 12 ben _ _
12 yachaysi _ Root_VDeriv Root_VDeriv +Ass=true|VRoot=true 0 sntc _ Gloss=saber,habitar
13 -y _ NS NS +Inf=true 12 ns _ _
14 . _ $. $. _ 0 punc _ _
# sent_id = DW-s41_1
# text = Tiqsimuyu -pi medio -pi willa -y apa -y -manta waynakuna -paq yachaysi -y .
1 Tiqsimuyu _ Root Root NRoot=true 2 s.arg _ Gloss=globo,tierra,mundo
2 -pi _ Cas Cas +Loc=true 4 co _ _
3 medio _ Root Root NRootES=true 4 s.arg _ _
4 -pi _ Cas Cas +Loc=true 12 mod _ _
5 willa _ Root Root VRoot=true 7 obj _ Gloss=contar
6 -y _ NS NS +Inf=true 5 ns _ _
7 apa _ Root Root VRoot=true 9 s.arg.claus _ Gloss=llevar
8 -y _ NS NS +Inf=true _ _ _ _
9 -manta _ Cas Cas +Abl=true 12 mod _ _
10 waynakuna _ Root_Num Root_Num +Pl=true|NRoot=true 11 s.arg _ Gloss=joven
11 -paq _ Cas Cas +Ben=true 12 ben _ _
12 yachaysi _ Root_VDeriv Root_VDeriv +Ass=true|VRoot=true 0 sntc _ Gloss=saber,habitar
13 -y _ NS NS +Inf=true 12 ns _ _
14 . _ $. $. _ 0 punc _ _
This removes the edge, but we would like to have a way to delete the 8 -y
node and merge the surface form with node 7. E.g. update the "surface" column of line 7 to be the concatenation of the surface columns in lines 7 and 8.
Is this possible? We could not find it in the documentation.