GrammaticalFramework / gf-ud

Functions to analyse and manipulate dependency trees, as well as conversions between GF and dependency trees. The main use case is UD (Universal Dependencies), but the code is designed to be completely generic as for annotation scheme. This repository replaces the old gf-contrib/ud2gf code. It is also meant to be used in the 'vd' command of GF and replace the supporting code in gf-core in the future.
Other
7 stars 15 forks source link

Feature request: output something that is like bt0 but macros expanded on subtrees #34

Closed inariksit closed 2 years ago

inariksit commented 2 years ago

This is a common occurrence: I convert some large tree with ud2gf, and get output like this

[2,3] critical 3 (2) ADJ root (root_cop (rootA_ (PositA critical_A)) be_cop : UDS[2,3]) 1
    *[1] it 1 (2) PRON expl (root_only (rootN_ (UsePron it_Pron)) : UDS[1]) 1
    [2] is 2 (1) AUX cop (be_cop : cop[2]) 1
    *[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21] do 5 (4) VERB csubj (root_advcl (rootV_ (OblVP_ (ComplV do_V (DetCN_a_ (DetQuant IndefArt NumSg) (AdjCN (PositA preliminary_A) (UseN assessment_N)))) (PrepNP upon_Prep (MassNP_sg (AdvCN (UseN discovery_N) (PrepNP of_Prep (DetCN_a_ (DetQuant IndefArt NumSg) (UseN (CompoundN data_N breach_N))))))))) (advclMarkUDS_ to_mark (root_advcl (rootV_ (UseV see_V)) (advclMarkUDS_ (mark_ if_Subj) (root_nsubj (rootV_ (ComplV warrant_V (DetCN_a_ (DetQuant IndefArt NumSg) (UseN notification_N)))) (nsubj_ (UsePron it_Pron)))))) : UDS[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]) 1
        *[4] to 4 (3) PART mark (to_mark : mark[4]) 1
        [6,7,8] assessment 8 (7) NOUN obj (DetCN_a_ (DetQuant IndefArt NumSg) (AdjCN (PositA preliminary_A) (UseN assessment_N)) : NP[6,7,8]) 1
            [6] a 6 (5) DET det (DetQuant IndefArt NumSg : Det[6]) 1
            [7] preliminary 7 (6) ADJ amod (PositA preliminary_A : AP[7]) 1
        [9,10,11,12,13,14] discovery 10 (9) NOUN obl (PrepNP upon_Prep (MassNP_sg (AdvCN (UseN discovery_N) (PrepNP of_Prep (DetCN_a_ (DetQuant IndefArt NumSg) (UseN (CompoundN data_N breach_N)))))) : Adv[9,10,11,12,13,14]) 1
            [9] upon 9 (8) ADP case (upon_Prep : Prep[9]) 1
            [11,12,13,14] breach 14 (13) NOUN nmod (PrepNP of_Prep (DetCN_a_ (DetQuant IndefArt NumSg) (UseN (CompoundN data_N breach_N))) : Adv[11,12,13,14]) 1
                [11] of 11 (10) ADP case (of_Prep : Prep[11]) 1
                [12] a 12 (11) DET det (DetQuant IndefArt NumSg : Det[12]) 1
                [13] data 13 (12) NOUN compound (data_N : N[13]) 1
        [15,16,17,18,19,20,21] see 16 (15) VERB advcl (advclMarkUDS_ to_mark (root_advcl (rootV_ (UseV see_V)) (advclMarkUDS_ (mark_ if_Subj) (root_nsubj (rootV_ (ComplV warrant_V (DetCN_a_ (DetQuant IndefArt NumSg) (UseN notification_N)))) (nsubj_ (UsePron it_Pron))))) : advcl[15,16,17,18,19,20,21]) 1
            [15] to 15 (14) PART mark (to_mark : mark[15]) 1
            [17,18,19,20,21] warrants 19 (18) VERB advcl (advclMarkUDS_ (mark_ if_Subj) (root_nsubj (rootV_ (ComplV warrant_V (DetCN_a_ (DetQuant IndefArt NumSg) (UseN notification_N)))) (nsubj_ (UsePron it_Pron))) : advcl[17,18,19,20,21]) 1
                [17] if 17 (16) SCONJ mark (mark_ if_Subj : mark[17]) 1
                [18] it 18 (17) PRON nsubj (nsubj_ (UsePron it_Pron) : nsubj[18]) 1
                [20,21] notification 21 (20) NOUN obj (DetCN_a_ (DetQuant IndefArt NumSg) (UseN notification_N) : NP[20,21]) 1
                    [20] a 20 (19) DET det (DetQuant IndefArt NumSg : Det[20]) 1

I would like to linearise the subtree [4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21], but it is full of auxfuns, and I need to manually replace lots of auxfuns before I get it to linearise. Is there any way to output partial subtrees that have auxfuns expanded, to make debugging easier?