Skip to content

Commit 9f1c9ad

Browse files
author
Federica Gamba (PhD
committed
Further adjusted Latin feature rules.
1 parent faeecb5 commit 9f1c9ad

File tree

1 file changed

+107
-48
lines changed

1 file changed

+107
-48
lines changed

udapi/block/ud/la/markfeatsbugs.py

Lines changed: 107 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def process_node(self, node):
2929
af = {}
3030
# NOUNS ################################################################
3131
if node.upos == 'NOUN':
32-
if not node.feats['Abbr'] == 'Yes':
32+
if not node.feats['Abbr'] == 'Yes' or node.feats['Case']: # abbreviated or indeclinable nouns
3333
rf = ['Gender', 'Number', 'Case']
3434
af = {
3535
'Gender': ['Masc', 'Fem', 'Neut'],
@@ -41,61 +41,71 @@ def process_node(self, node):
4141
if self.flavio:
4242
# Flavio added InflClass but not everywhere, so it is not required.
4343
af['InflClass'] = ['IndEurA', 'IndEurE', 'IndEurI', 'IndEurO', 'IndEurU', 'IndEurX']
44+
af['VerbForm'] = ['Part']
45+
af['Proper'] = ['Yes']
46+
af['Compound'] = ['Yes']
47+
af['NameType'] = ['Ast', 'Cal', 'Com', 'Geo', 'Giv', 'Let', 'Lit', 'Met', 'Nat', 'Rel', 'Sur', 'Oth']
4448
self.check_required_features(node, rf)
4549
self.check_allowed_features(node, af)
4650
# PROPER NOUNS #########################################################
4751
elif node.upos == 'PROPN':
48-
if not node.feats['Abbr'] == 'Yes':
52+
if not node.feats['Abbr'] == 'Yes' and node.feats['Case']: # abbreviated and indeclinable nouns
4953
rf = ['Gender', 'Number', 'Case']
5054
af = {
5155
'Gender': ['Masc', 'Fem', 'Neut'],
5256
'Number': ['Sing', 'Plur'],
5357
'Case': ['Nom', 'Gen', 'Dat', 'Acc', 'Voc', 'Loc', 'Abl'],
54-
'NameType': ['Giv', 'Sur', 'Geo'],
5558
'Abbr': ['Yes'],
5659
'Foreign': ['Yes']}
5760
if self.flavio:
58-
# Flavio added InflClass but not everywhere, so it is not required.
59-
af['InflClass'] = ['IndEurA', 'IndEurE', 'IndEurI', 'IndEurO', 'IndEurU', 'IndEurX']
60-
af['Proper'] = ['Yes']
61+
af['Compound'] = 'Yes'
62+
af['NameType'] = ['Ast', 'Cal', 'Com', 'Geo', 'Giv', 'Let', 'Lit', 'Met', 'Nat', 'Rel', 'Sur', 'Oth']
63+
if not node.feats['Abbr'] == 'Yes' and node.feats['Case']:
64+
af['InflClass'] = ['IndEurA', 'IndEurE', 'IndEurI', 'IndEurO', 'IndEurU', 'IndEurX']
6165
self.check_required_features(node, rf)
6266
self.check_allowed_features(node, af)
6367
# ADJECTIVES ###########################################################
6468
elif node.upos == 'ADJ':
65-
if not node.feats['Abbr'] == 'Yes':
66-
rf = ['Gender', 'Number', 'Case', 'Degree']
69+
if not node.feats['Abbr'] == 'Yes' and node.feats['Case']:
70+
rf = ['Gender', 'Number', 'Case']
6771
af = {
6872
'NumType': ['Ord', 'Dist'],
6973
'Gender': ['Masc', 'Fem', 'Neut'],
7074
'Number': ['Sing', 'Plur'],
7175
'Case': ['Nom', 'Gen', 'Dat', 'Acc', 'Voc', 'Loc', 'Abl'],
72-
'Degree': ['Pos', 'Cmp', 'Sup', 'Abs'],
76+
'Degree': ['Cmp', 'Sup', 'Abs'],
7377
'Abbr': ['Yes'],
74-
'Foreign': ['Yes']}
78+
'Foreign': ['Yes'],
79+
'Polarity': ['Neg']}
7580
if self.flavio:
7681
# Flavio does not use Degree=Pos, hence Degree is not required.
77-
rf = [f for f in rf if f != 'Degree']
82+
# rf = [f for f in rf if f != 'Degree']
7883
# Flavio added InflClass but not everywhere, so it is not required.
7984
af['InflClass'] = ['IndEurA', 'IndEurE', 'IndEurI', 'IndEurO', 'IndEurU', 'IndEurX']
8085
af['Compound'] = ['Yes']
86+
af['VerbForm'] = ['Part']
8187
af['Proper'] = ['Yes']
88+
af['Degree'].append('Dim')
89+
af['NameType'] = ['Ast', 'Cal', 'Com', 'Geo', 'Giv', 'Let', 'Lit', 'Met', 'Nat', 'Rel', 'Sur', 'Oth']
8290
self.check_required_features(node, rf)
8391
self.check_allowed_features(node, af)
8492
# PRONOUNS #############################################################
8593
elif node.upos == 'PRON':
8694
rf = ['PronType', 'Case']
8795
af = {
88-
'PronType': ['Prs', 'Rel', 'Ind'],
96+
'PronType': ['Prs', 'Rel', 'Ind', 'Int', 'Rcp'],
8997
'Case': ['Nom', 'Gen', 'Dat', 'Acc', 'Voc', 'Loc', 'Abl']
9098
}
9199
if node.feats['PronType'] == 'Prs':
92100
af['Reflex'] = ['Yes']
93101
if node.feats['Reflex'] == 'Yes': # seipsum, se
102+
rf.extend(['Person'])
94103
# seipsum has gender and number but se does not, so it is not required
95-
af['Gender'] = ['Masc']
96-
af['Number'] = ['Sing']
104+
# TODO: seipsum in ITTB, but why lemma seipsum instead of seipse?
105+
af['Gender'] = ['Masc', 'Fem', 'Neut']
106+
af['Number'] = ['Sing', 'Plur']
97107
af['Person'] = ['3']
98-
af['Case'] = ['Gen', 'Dat', 'Acc', 'Loc', 'Abl']
108+
af['Case'] = ['Nom', 'Gen', 'Dat', 'Acc', 'Loc', 'Abl']
99109
else: # not reflexive: ego, tu, is, nos
100110
rf.extend(['Person', 'Number'])
101111
af['Person'] = ['1', '2', '3']
@@ -104,22 +114,34 @@ def process_node(self, node):
104114
if node.feats['Person'] == '3': # is, id
105115
rf.append('Gender')
106116
af['Gender'] = ['Masc', 'Fem', 'Neut']
107-
elif re.match(r'^(Rel|Ind)$', node.feats['PronType']):
117+
elif re.match(r'^(Rel|Int)$', node.feats['PronType']):
108118
rf.extend(['Gender', 'Number'])
109119
af['Gender'] = ['Masc', 'Fem', 'Neut']
110120
af['Number'] = ['Sing', 'Plur']
121+
elif node.feats['PronType'] == 'Ind':
122+
rf = [f for f in rf if f != 'Case']
123+
af['Gender'] = ['Masc', 'Fem', 'Neut']
124+
af['Number'] = ['Sing', 'Plur']
111125
if self.flavio:
112126
# Flavio added InflClass but not everywhere, so it is not required.
113127
af['InflClass'] = ['LatAnom', 'LatPron']
128+
af['Compound'] = ['Yes']
129+
af['Polarity'] = ['Neg']
130+
af['Form'] = ['Emp']
114131
self.check_required_features(node, rf)
115132
self.check_allowed_features(node, af)
116133
# DETERMINERS ##########################################################
117134
elif node.upos == 'DET':
118-
rf = ['PronType', 'Gender', 'Number', 'Case']
135+
rf = ['PronType']
136+
if node.feats['Case']:
137+
rf.extend(['Gender', 'Number', 'Case'])
119138
af = {
120139
'Gender': ['Masc', 'Fem', 'Neut'],
121140
'Number': ['Sing', 'Plur'],
122-
'Case': ['Nom', 'Gen', 'Dat', 'Acc', 'Voc', 'Loc', 'Abl']}
141+
'Case': ['Nom', 'Gen', 'Dat', 'Acc', 'Voc', 'Loc', 'Abl'],
142+
'Degree': ['Cmp', 'Abs', 'Sup'],
143+
'Polarity': ['Neg']
144+
}
123145
if node.feats['Poss'] == 'Yes': # 'meus', 'tuus', 'suus', 'noster'
124146
rf.extend(['Poss', 'Person[psor]'])
125147
af['PronType'] = ['Prs']
@@ -131,11 +153,16 @@ def process_node(self, node):
131153
rf.append('Number[psor]')
132154
af['Number[psor]'] = ['Sing', 'Plur']
133155
else:
134-
af['PronType'] = ['Dem', 'Rel', 'Ind', 'Tot', 'Con']
156+
af['PronType'] = ['Dem', 'Rel', 'Ind', 'Int', 'Tot', 'Con']
135157
if self.flavio:
136158
# Flavio added InflClass but not everywhere, so it is not required.
137-
af['InflClass'] = ['IndEurA', 'IndEurI', 'IndEurO', 'LatPron']
159+
af['InflClass'] = ['IndEurA', 'IndEurI', 'IndEurO', 'IndEurX', 'LatPron']
160+
af['Compound'] = ['Yes']
138161
af['Form'] = ['Emp']
162+
af['NumType'] = ['Card']
163+
af['Degree'].append('Dim')
164+
if re.match(r'^(unus|ambo)', node.lemma):
165+
af['NumValue'] = ['1', '2']
139166
self.check_required_features(node, rf)
140167
self.check_allowed_features(node, af)
141168
# NUMERALS #############################################################
@@ -151,71 +178,103 @@ def process_node(self, node):
151178
af['Number'] = ['Sing', 'Plur']
152179
af['Case'] = ['Nom', 'Gen', 'Dat', 'Acc', 'Voc', 'Loc', 'Abl']
153180
if self.flavio:
154-
# Flavio added InflClass but not everywhere, so it is not required.
181+
# Flavio added InflClass but not everywhere, so it is not required. # e.g. duodecim
155182
af['InflClass'] = ['IndEurA', 'IndEurI', 'IndEurO', 'LatPron']
156183
self.check_required_features(node, rf)
157184
self.check_allowed_features(node, af)
158185
# VERBS AND AUXILIARIES ################################################
159186
elif re.match(r'^(VERB|AUX)$', node.upos):
160-
rf = ['VerbForm']
187+
rf = ['VerbForm', 'Aspect']
161188
af = {
162-
'VerbForm': ['Inf', 'Fin', 'Part', 'Vnoun'],
163-
'Polarity': ['Pos', 'Neg']}
189+
'VerbForm': ['Inf', 'Fin', 'Part'],
190+
'Aspect': ['Imp', 'Inch', 'Perf', 'Prosp'],
191+
'Polarity': ['Neg']
192+
}
193+
if not re.match(r'^(Ger|Gdv)$', node.feats['VerbForm']):
194+
rf.append('Tense')
195+
af['Tense'] = ['Pres', 'Fut']
196+
if node.upos == 'VERB': # and not node.lemma.endswith('sum'): # compounds of sum
197+
rf.append('Voice')
198+
af['Voice'] = ['Act', 'Pass']
164199
# Main verbs have aspect but auxiliaries don't.
165-
if node.upos == 'VERB':
166-
rf.append('Aspect')
167-
af['Aspect'] = ['Imp', 'Perf', 'Prosp']
168-
if node.feats['VerbForm'] == 'Fin':
200+
# TODO: apparently, apparently AUXs have aspect as well
201+
# if node.upos == 'VERB':
202+
# rf.append('Aspect')
203+
# af['Aspect'] = ['Imp', 'Inch', 'Perf', 'Prosp']
204+
if node.feats['VerbForm'] == 'Fin': # imperative, indicative or subjunctive
169205
rf.extend(['Mood', 'Person', 'Number'])
206+
af['Tense'].extend(['Past', 'Pqp'])
170207
af['Mood'] = ['Ind', 'Sub', 'Imp']
171208
af['Person'] = ['1', '2', '3']
172209
af['Number'] = ['Sing', 'Plur']
173-
if re.match(r'^(Ind|Sub)$', node.feats['Mood']): # indicative or subjunctive
174-
rf.extend(['Voice', 'Tense'])
175-
af['Voice'] = ['Act', 'Pass']
176-
af['Tense'] = ['Past', 'Imp', 'Pres', 'Fut']
177210
elif node.feats['VerbForm'] == 'Part':
178-
rf.extend(['Tense', 'Gender', 'Number', 'Voice', 'Case'])
179-
af['Tense'] = ['Past']
180-
af['Voice'] = ['Act', 'Pass']
211+
rf.extend(['Gender', 'Number', 'Case'])
181212
af['Number'] = ['Sing', 'Plur']
182213
af['Gender'] = ['Masc', 'Fem', 'Neut']
183214
af['Case'] = ['Nom', 'Gen', 'Dat', 'Acc', 'Voc', 'Loc', 'Abl']
184-
af['Degree'] = ['Abs']
185-
elif node.feats['VerbForm'] == 'Vnoun':
186-
rf.extend(['Tense', 'Voice'])
187-
af['Tense'] = ['Past', 'Pres']
188-
af['Voice'] = ['Act', 'Pass']
215+
af['Degree'] = ['Abs', 'Cmp']
189216
af['Gender'] = ['Masc', 'Fem', 'Neut']
190-
# else: nothing to be added form VerbForm=Inf
217+
af['Tense'].append('Past')
218+
# else: nothing to be added for VerbForm=Inf
191219
if self.flavio:
192220
# Flavio has killed Tense in his treebanks.
193221
rf = [f for f in rf if f != 'Tense']
222+
af['VerbForm'].append('Vnoun')
194223
# Flavio added InflClass but not everywhere, so it is not required.
195-
af['InflClass'] = ['LatA', 'LatAnom', 'LatE', 'LatI2', 'LatX']
196-
if node.feats['VerbForm'] == 'Part':
224+
af['InflClass'] = ['LatA', 'LatAnom', 'LatE', 'LatI', 'LatI2', 'LatX']
225+
if 'Degree' in af:
226+
af['Degree'].append('Dim')
227+
else:
228+
af['Degree'] = ['Dim']
229+
af['Compound'] = ['Yes']
230+
af['Proper'] = ['Yes']
231+
if re.match(r'^(Part|Vnoun)$', node.feats['VerbForm']):
197232
af['InflClass[nominal]'] = ['IndEurA', 'IndEurI', 'IndEurO']
233+
af['VerbForm'].append('Vnoun')
198234
self.check_required_features(node, rf)
199235
self.check_allowed_features(node, af)
200236
# ADVERBS ##############################################################
201237
elif node.upos == 'ADV':
202238
af = {
203239
'AdvType': ['Loc', 'Tim'],
204240
'PronType': ['Dem', 'Int', 'Rel', 'Ind', 'Neg', 'Tot', 'Con'],
205-
'Degree': ['Pos', 'Cmp', 'Sup', 'Abs']
241+
'Degree': ['Pos', 'Cmp', 'Sup', 'Abs'],
242+
'Polarity': ['Neg']
206243
}
207244
if self.flavio:
208-
af['Compound'] = 'Yes'
209-
af['Form'] = 'Emp'
245+
af['Compound'] = ['Yes']
246+
af['Form'] = ['Emp']
247+
af['NumType'] = ['Card', 'Ord'] # e.g., primum
248+
af['VerbForm'] = ['Part']
249+
af['Degree'].append('Dim')
210250
self.check_allowed_features(node, af)
211251
# PARTICLES ############################################################
212252
elif node.upos == 'PART':
213253
af = {
214-
'PartType': ['Int'],
254+
'PartType': ['Int', 'Emp'],
215255
'Polarity': ['Neg']
216256
}
217257
if self.flavio:
218-
af['Form'] = 'Emp'
258+
af['Form'] = ['Emp']
259+
af['PronType'] = ['Dem']
260+
self.check_allowed_features(node, af)
261+
# CONJUNCTIONS #########################################################
262+
elif re.match(r'^[CS]CONJ$', node.upos):
263+
af = {
264+
'PronType': ['Rel', 'Con'],
265+
'Polarity': ['Neg']}
266+
if self.flavio:
267+
af['Compound'] = ['Yes']
268+
af['Form'] = ['Emp']
269+
af['VerbForm'] = ['Fin']
270+
af['NumType'] = ['Card']
271+
self.check_allowed_features(node, af)
272+
# ADPOSITIONS ##########################################################
273+
elif node.upos == 'ADP':
274+
if self.flavio:
275+
af = {
276+
'VerbForm': ['Part'],
277+
'Proper': ['Yes']}
219278
self.check_allowed_features(node, af)
220279
# THE REST: NO FEATURES ################################################
221280
else:

0 commit comments

Comments
 (0)