Skip to content

Commit f18143a

Browse files
committed
Update od Lenky.
1 parent 82c3ccd commit f18143a

8 files changed

Lines changed: 199 additions & 60 deletions

File tree

udapi/block/mwe/slavic/conditional.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Conditional(udapi.block.mwe.msfphrase.MsfPhrase):
88

99
def process_node(self, node):
10-
if node.feats['VerbForm'] == 'Part' or node.feats['VerbForm'] == 'Fin':
10+
if (node.feats['VerbForm'] == 'Part' or node.feats['VerbForm'] == 'PartRes') or node.feats['VerbForm'] == 'Fin':
1111
# in most Slavic languages, the verb has feats['VerbForm'] == 'Part' but in Polish the verb has feats['VerbForm'] == 'Fin'
1212

1313
aux_cnd = [x for x in node.children if x.feats['Mood'] == 'Cnd' or x.deprel == 'aux:cnd'] # list for auxiliary verbs for forming the conditional mood
@@ -19,18 +19,19 @@ def process_node(self, node):
1919

2020
if len(aux_cnd) > 0 and len(cop) == 0:
2121
aux = [x for x in node.children if x.udeprel == 'aux' or x.feats['Mood'] == 'Cnd'] # all auxiliary verbs and conjuctions with feats['Mood'] == 'Cnd'
22-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
22+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
2323
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
2424

2525
phrase_ords = [node.ord] + [x.ord for x in aux] + [x.ord for x in refl] + [x.ord for x in neg]
2626
phrase_ords.sort()
2727

2828
auxVerb = aux_cnd[0]
2929

30-
person='3' # TODO there could be a problem in russian etc. (same as in past tense)
30+
person='3' # TODO there is a problem in russian etc. (same as in past tense)
3131
if auxVerb.feats['Person'] != '':
3232
person=auxVerb.feats['Person']
3333

34+
3435
self.write_node_info(node,
3536
person=person,
3637
number=node.feats['Number'],
@@ -45,29 +46,31 @@ def process_node(self, node):
4546
animacy=node.feats['Animacy']
4647
)
4748
return
49+
4850

4951
cop = [x for x in node.children if x.udeprel == 'cop' and (x.feats['VerbForm'] == 'Part' or x.feats['VerbForm'] == 'Fin')]
50-
aux_cnd = [x for x in node.children if x.feats['Mood'] == 'Cnd' or x.deprel=='aux:pass']
52+
aux_cnd = [x for x in node.children if x.feats['Mood'] == 'Cnd' or x.deprel=='aux:cnd']
5153

5254
if len(cop) > 0 and len(aux_cnd) > 0:
53-
aux = [x for x in node.children if x.udeprel == 'aux' or x.feats['Mood'] == 'Cnd']
55+
# there can be a copula with Mood='Cnd' (i. e. in Old East Slavonic), we don't want to count these copula in phrase_ords twice, so there is x.udeprel != 'cop' in aux list
56+
aux = [x for x in node.children if (x.udeprel == 'aux' or x.feats['Mood'] == 'Cnd') and x.udeprel != 'cop']
5457
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
5558
prep = [x for x in node.children if x.upos == 'ADP']
56-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
59+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
5760

5861
copVerb = cop[0]
5962
phrase_ords = [node.ord] + [x.ord for x in aux] + [x.ord for x in cop] + [x.ord for x in neg] + [x.ord for x in prep] + [x.ord for x in refl]
6063
phrase_ords.sort()
6164
self.write_node_info(node,
65+
aspect=copVerb.feats['Aspect'],
6266
person=copVerb.feats['Person'],
6367
number=copVerb.feats['Number'],
6468
mood='Cnd',
6569
form='Fin',
66-
voice=self.get_voice(node, refl),
70+
voice=self.get_voice(copVerb, refl),
6771
polarity=self.get_polarity(copVerb,neg),
6872
reflex=self.get_is_reflex(node, refl),
6973
ords=phrase_ords,
7074
gender=copVerb.feats['Gender'],
7175
animacy=copVerb.feats['Animacy']
7276
)
73-

udapi/block/mwe/slavic/converb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, writer_prefix='',**kwargs):
2525
def process_node(self, node):
2626
# condition node.upos == 'VERB' to prevent copulas from entering this branch
2727
if node.feats['VerbForm'] == 'Conv' and node.upos == 'VERB':
28-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
28+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
2929
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
3030

3131
phrase_ords = [node.ord] + [x.ord for x in refl] + [x.ord for x in neg]
@@ -75,7 +75,7 @@ def process_node(self, node):
7575
if len(cop) > 0:
7676
prep = [x for x in node.children if x.upos == 'ADP']
7777
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
78-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
78+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
7979

8080
copVerb = cop[0]
8181
phrase_ords = [node.ord] + [x.ord for x in cop] + [x.ord for x in prep] + [x.ord for x in neg] + [x.ord for x in refl]
@@ -91,6 +91,6 @@ def process_node(self, node):
9191
form='Conv',
9292
polarity=self.wr.get_polarity(node,neg),
9393
ords=phrase_ords,
94-
voice=self.wr.get_voice(node, refl)
94+
voice=self.wr.get_voice(copVerb, refl)
9595
)
9696

udapi/block/mwe/slavic/future.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def process_node(self, node):
2626
# future tense for Serbian and Croatian
2727
aux = [x for x in node.children if x.udeprel == 'aux' and x.feats['Tense'] == 'Pres' and (x.lemma == 'hteti' or x.lemma == 'htjeti')]
2828
if node.upos != 'AUX' and len(aux) != 0:
29-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
29+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
3030
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
3131
aux_other = [x for x in node.children if x.udeprel == 'aux'] # adding aux for passive voice
3232
cop = [x for x in node.children if x.deprel == 'cop']
@@ -80,7 +80,7 @@ def process_node(self, node):
8080
aux = [x for x in node.children if x.lemma == 'ќе' or x.lemma == 'ще']
8181

8282
if node.feats['Tense'] == 'Pres' and len(aux) > 0:
83-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
83+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
8484
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
8585
phrase_ords = [node.ord] + [x.ord for x in refl] + [x.ord for x in neg] + [x.ord for x in aux]
8686
phrase_ords.sort()
@@ -103,7 +103,7 @@ def process_node(self, node):
103103
# Upper Sorbian forms the future tense in this way, however, the feats[Aspect] are not listed in the data
104104
# in some languages ​​(e.g. in Russian) these verbs have the Tense Fut, in others (e.g. in Czech) they have the Tense Pres
105105
"""if node.feats['Aspect'] == 'Perf' and (node.feats['Tense'] == 'Pres' or node.feats['Tense'] == 'Fut') and node.feats['VerbForm'] != 'Conv':
106-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
106+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
107107
108108
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
109109
@@ -132,7 +132,7 @@ def process_node(self, node):
132132

133133
aux = [x for x in node.children if x.udeprel == 'aux' and x.feats['Tense'] == 'Fut']
134134

135-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
135+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
136136
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
137137
if len(aux) > 0:
138138
auxVerb = aux[0]
@@ -183,7 +183,7 @@ def process_node(self, node):
183183
aux = [x for x in node.children if x.udeprel == 'aux' and x.feats['Mood']=='Ind']
184184
prep = [x for x in node.children if x.upos == 'ADP']
185185
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
186-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
186+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
187187

188188
phrase_ords = [node.ord] + [x.ord for x in cop] + [x.ord for x in aux] + [x.ord for x in prep] + [x.ord for x in neg] + [x.ord for x in refl]
189189
phrase_ords.sort()
@@ -194,7 +194,7 @@ def process_node(self, node):
194194
number=copVerb.feats['Number'],
195195
mood='Ind',
196196
form='Fin',
197-
voice=self.wr.get_voice(node, refl),
197+
voice=self.wr.get_voice(copVerb, refl),
198198
polarity=self.wr.get_polarity(copVerb,neg),
199199
ords=phrase_ords
200200
)

udapi/block/mwe/slavic/imperative.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, writer_prefix='',**kwargs):
2525
def process_node(self, node):
2626
# the condition node.upos == 'VERB' ensures that copulas do not enter this branch
2727
if node.feats['Mood'] == 'Imp' and node.upos == 'VERB':
28-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
28+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
2929
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
3030

3131
phrase_ords = [node.ord] + [x.ord for x in refl] + [x.ord for x in neg]
@@ -72,7 +72,7 @@ def process_node(self, node):
7272
if len(cop) > 0:
7373
prep = [x for x in node.children if x.upos == 'ADP']
7474
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
75-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
75+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
7676

7777
copVerb = cop[0]
7878
phrase_ords = [node.ord] + [x.ord for x in cop] + [x.ord for x in prep] + [x.ord for x in neg] + [x.ord for x in refl]
@@ -83,7 +83,7 @@ def process_node(self, node):
8383
number=copVerb.feats['Number'],
8484
mood='Imp',
8585
form='Fin',
86-
voice=self.wr.get_voice(node, refl),
86+
voice=self.wr.get_voice(copVerb, refl),
8787
reflex=self.wr.get_is_reflex(node, refl),
8888
polarity=self.wr.get_polarity(node,neg),
8989
ords=phrase_ords

udapi/block/mwe/slavic/infinitive.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def process_node(self,node):
2626
if node.feats['VerbForm'] == 'Inf' and node.upos == 'VERB':
2727
aux = [x for x in node.children if x.udeprel == 'aux']
2828
if len(aux) == 0: # the list of auxiliary list must be empty - we don't want to mark infinitives which are part of any other phrase (for example the infinititive is part of the future tense in Czech)
29-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
29+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
3030
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
3131

3232
phrase_ords = [node.ord] + [x.ord for x in refl] + [x.ord for x in neg]
@@ -51,7 +51,7 @@ def process_node(self,node):
5151
aux_forb = [x for x in node.children if x.udeprel == 'aux' and x.feats['VerbForm'] != 'Inf']
5252
if len(aux) > 0 and len(aux_forb) == 0:
5353
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
54-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
54+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
5555

5656
phrase_ords = [node.ord] + [x.ord for x in aux] + [x.ord for x in neg] + [x.ord for x in refl]
5757
phrase_ords.sort()
@@ -76,15 +76,33 @@ def process_node(self,node):
7676
if len(cop) > 0 and len(aux_forb) == 0:
7777
prep = [x for x in node.children if x.upos == 'ADP']
7878
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
79-
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes']
79+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
8080
phrase_ords = [node.ord] + [x.ord for x in cop] + [x.ord for x in prep] + [x.ord for x in neg] + [x.ord for x in refl]
8181
phrase_ords.sort()
8282

8383
self.wr.write_node_info(node,
84-
voice=self.wr.get_voice(node, refl),
84+
voice=self.wr.get_voice(cop[0], refl),
8585
form='Inf',
8686
polarity=self.wr.get_polarity(cop[0],neg),
8787
reflex=self.wr.get_is_reflex(node, refl),
8888
ords=phrase_ords
8989
)
90+
91+
# there is a rare verb form called supine in Slovenian, it is used instead of infinitive as the argument of motion verbs
92+
if node.feats['VerbForm'] == 'Sup':
93+
refl = [x for x in node.children if x.feats['Reflex'] == 'Yes' and x.udeprel == 'expl']
94+
neg = [x for x in node.children if x.feats['Polarity'] == 'Neg' and x.upos == 'PART']
95+
96+
phrase_ords = [node.ord] + [x.ord for x in refl] + [x.ord for x in neg]
97+
phrase_ords.sort()
98+
99+
self.wr.write_node_info(node,
100+
aspect=node.feats['Aspect'],
101+
voice='Act',
102+
form='Sup',
103+
polarity=self.wr.get_polarity(node,neg),
104+
reflex=self.wr.get_is_reflex(node, refl),
105+
ords=phrase_ords
106+
)
107+
90108

0 commit comments

Comments
 (0)