@@ -53,7 +53,7 @@ def __init__(self, check_paired_punct_upos=False, copy_to_enhanced=False, **kwar
53
53
based on the form with the exception of single & double quote character,
54
54
which is frequently ambiguous*, so UPOS=PUNCT is checked always.
55
55
*) Single quote can be an apostrophe. Double quote as a NOUN can be the inch symbol.
56
- copy_to_enhanced: for all upos=PUNCT deprel=punct nodes , let the enhanced depencies
56
+ copy_to_enhanced: for all upos=PUNCT, let the enhanced depencies
57
57
be the same as the basic dependencies.
58
58
"""
59
59
super ().__init__ (** kwargs )
@@ -111,15 +111,17 @@ def process_tree(self, root):
111
111
# This may not hold if the original subroot was a paired punctuation, which was rehanged.
112
112
if root .children [0 ].udeprel != 'root' :
113
113
root .children [0 ].udeprel = 'root'
114
+ if self .copy_to_enhanced :
115
+ root .children [0 ].deps = [{'parent' : root , 'deprel' : 'root' }]
114
116
for another_node in root .children [0 ].descendants :
115
117
if another_node .udeprel == 'root' :
116
118
another_node .udeprel = 'punct'
117
119
118
120
# TODO: This block changes parents not only for PUNCT nodes. These should be reflected into enhanced deps as well.
119
121
if self .copy_to_enhanced :
120
122
for node in root .descendants :
121
- if node .upos == 'PUNCT' and node . udeprel == 'punct' :
122
- node .deps = [{'parent' : node .parent , 'deprel' : 'punct' }]
123
+ if node .upos == 'PUNCT' :
124
+ node .deps = [{'parent' : node .parent , 'deprel' : node . deprel }]
123
125
124
126
def _fix_subord_punct (self , node ):
125
127
# Dot used as the ordinal-number marker (in some languages) or abbreviation marker.
0 commit comments