@@ -29,19 +29,19 @@ def process_node(self, node):
29
29
af = {}
30
30
# NOUNS ################################################################
31
31
if node .upos == 'NOUN' :
32
- if not node .feats ['Abbr ' ] == 'Yes' or node .feats ['Case' ] : # abbreviated or indeclinable nouns
32
+ if node .feats ['Case ' ] and not node .feats ['Abbr' ] == 'Yes' : # abbreviated or indeclinable nouns
33
33
rf = ['Gender' , 'Number' , 'Case' ]
34
34
af = {
35
35
'Gender' : ['Masc' , 'Fem' , 'Neut' ],
36
36
'Number' : ['Sing' , 'Plur' ],
37
37
'Case' : ['Nom' , 'Gen' , 'Dat' , 'Acc' , 'Voc' , 'Loc' , 'Abl' ],
38
38
'Degree' : ['Dim' ],
39
39
'Abbr' : ['Yes' ],
40
- 'Foreign' : ['Yes' ]}
40
+ 'Foreign' : ['Yes' ],
41
+ 'VerbForm' : ['Part' ]}
41
42
if self .flavio :
42
43
# Flavio added InflClass but not everywhere, so it is not required.
43
44
af ['InflClass' ] = ['IndEurA' , 'IndEurE' , 'IndEurI' , 'IndEurO' , 'IndEurU' , 'IndEurX' ]
44
- af ['VerbForm' ] = ['Part' ]
45
45
af ['Proper' ] = ['Yes' ]
46
46
af ['Compound' ] = ['Yes' ]
47
47
af ['NameType' ] = ['Ast' , 'Cal' , 'Com' , 'Geo' , 'Giv' , 'Let' , 'Lit' , 'Met' , 'Nat' , 'Rel' , 'Sur' , 'Oth' ]
@@ -76,14 +76,12 @@ def process_node(self, node):
76
76
'Degree' : ['Cmp' , 'Sup' , 'Abs' ],
77
77
'Abbr' : ['Yes' ],
78
78
'Foreign' : ['Yes' ],
79
- 'Polarity' : ['Neg' ]}
79
+ 'Polarity' : ['Neg' ],
80
+ 'VerbForm' : ['Part' ]}
80
81
if self .flavio :
81
- # Flavio does not use Degree=Pos, hence Degree is not required.
82
- # rf = [f for f in rf if f != 'Degree']
83
82
# Flavio added InflClass but not everywhere, so it is not required.
84
83
af ['InflClass' ] = ['IndEurA' , 'IndEurE' , 'IndEurI' , 'IndEurO' , 'IndEurU' , 'IndEurX' ]
85
84
af ['Compound' ] = ['Yes' ]
86
- af ['VerbForm' ] = ['Part' ]
87
85
af ['Proper' ] = ['Yes' ]
88
86
af ['Degree' ].append ('Dim' )
89
87
af ['NameType' ] = ['Ast' , 'Cal' , 'Com' , 'Geo' , 'Giv' , 'Let' , 'Lit' , 'Met' , 'Nat' , 'Rel' , 'Sur' , 'Oth' ]
@@ -93,15 +91,16 @@ def process_node(self, node):
93
91
elif node .upos == 'PRON' :
94
92
rf = ['PronType' , 'Case' ]
95
93
af = {
96
- 'PronType' : ['Prs' , 'Rel' , 'Ind' , 'Int' , 'Rcp' ],
97
- 'Case' : ['Nom' , 'Gen' , 'Dat' , 'Acc' , 'Voc' , 'Loc' , 'Abl' ]
94
+ 'Case' : ['Nom' , 'Gen' , 'Dat' , 'Acc' , 'Voc' , 'Loc' , 'Abl' ],
95
+ 'Proper' : ['Yes' ],
96
+ 'Compound' : ['Yes' ],
97
+ 'Polarity' : ['Neg' ]
98
98
}
99
99
if node .feats ['PronType' ] == 'Prs' :
100
100
af ['Reflex' ] = ['Yes' ]
101
101
if node .feats ['Reflex' ] == 'Yes' : # seipsum, se
102
102
rf .extend (['Person' ])
103
103
# seipsum has gender and number but se does not, so it is not required
104
- # TODO: seipsum in ITTB, but why lemma seipsum instead of seipse?
105
104
af ['Gender' ] = ['Masc' , 'Fem' , 'Neut' ]
106
105
af ['Number' ] = ['Sing' , 'Plur' ]
107
106
af ['Person' ] = ['3' ]
@@ -122,6 +121,19 @@ def process_node(self, node):
122
121
rf = [f for f in rf if f != 'Case' ]
123
122
af ['Gender' ] = ['Masc' , 'Fem' , 'Neut' ]
124
123
af ['Number' ] = ['Sing' , 'Plur' ]
124
+ # lexical check of PronTypes
125
+ af ['PronType' ] = []
126
+ if node .lemma in ['is' , 'ego' , 'tu' , 'sui' , 'seipsum' , 'nos' , 'uos' , 'vos' , 'tumetipse' , 'nosmetipse' ]:
127
+ af ['PronType' ].append ('Prs' )
128
+ elif node .lemma in ['quis' , 'aliquis' , 'nihil' , 'nemo' , 'quivis' ]:
129
+ af ['PronType' ].append ('Ind' )
130
+ elif node .lemma in ['inuicem' , 'invicem' ]:
131
+ af ['PronType' ].append ('Rcp' )
132
+ rf .remove ('Case' )
133
+ elif node .lemma in ['quicumque' , 'qui' , 'quisquis' ]:
134
+ af ['PronType' ].append ('Rel' )
135
+ if node .lemma in ['qui' , 'quis' , 'quisnam' , 'ecquis' ]:
136
+ af ['PronType' ].append ('Int' )
125
137
if self .flavio :
126
138
# Flavio added InflClass but not everywhere, so it is not required.
127
139
af ['InflClass' ] = ['LatAnom' , 'LatPron' ]
@@ -140,7 +152,9 @@ def process_node(self, node):
140
152
'Number' : ['Sing' , 'Plur' ],
141
153
'Case' : ['Nom' , 'Gen' , 'Dat' , 'Acc' , 'Voc' , 'Loc' , 'Abl' ],
142
154
'Degree' : ['Cmp' , 'Abs' , 'Sup' ],
143
- 'Polarity' : ['Neg' ]
155
+ 'Polarity' : ['Neg' ],
156
+ 'Proper' : ['Yes' ],
157
+ 'PronType' : []
144
158
}
145
159
if node .feats ['Poss' ] == 'Yes' : # 'meus', 'tuus', 'suus', 'noster'
146
160
rf .extend (['Poss' , 'Person[psor]' ])
@@ -152,8 +166,24 @@ def process_node(self, node):
152
166
if node .feats ['Person[psor]' ] != '3' :
153
167
rf .append ('Number[psor]' )
154
168
af ['Number[psor]' ] = ['Sing' , 'Plur' ]
155
- else :
156
- af ['PronType' ] = ['Dem' , 'Rel' , 'Ind' , 'Int' , 'Tot' , 'Con' ]
169
+ if node .feats ['PronType' ] == 'Ind' :
170
+ af ['NumType' ] = ['Card' ]
171
+ # lexical check of PronTypes
172
+ if node .lemma in ['suus' , 'meus' , 'noster' , 'tuus' , 'uester' , 'vester' , 'voster' ]:
173
+ if not af ['PronType' ] == ['Prs' ]:
174
+ af ['PronType' ].append ('Prs' )
175
+ elif node .lemma in ['aliquot' , 'quidam' , 'quispiam' , 'quivis' , 'nullus' , 'nonnullus' , 'aliqui' , 'qui' , 'quilibet' , 'quantuslibet' , 'unus' , 'uterque' , 'ullus' , 'multus' , 'quisque' , 'paucus' , 'complures' , 'quamplures' , 'quicumque' , 'reliquus' , 'plerusque' , 'aliqualis' , 'quisquam' , 'qualiscumque' ]:
176
+ af ['PronType' ].append ('Ind' )
177
+ elif node .lemma in ['omnis' , 'totus' , 'ambo' , 'cunctus' , 'unusquisque' , 'uniuersus' ]:
178
+ af ['PronType' ].append ('Tot' )
179
+ if node .lemma in ['quantus' , 'qualis' , 'quicumque' , 'quot' , 'quotus' ]:
180
+ af ['PronType' ].append ('Rel' )
181
+ elif node .lemma in ['qui' , 'quantus' , 'quot' ]:
182
+ af ['PronType' ].append ('Int' )
183
+ elif node .lemma in ['hic' , 'ipse' , 'ille' , 'tantus' , 'talis' , 'is' , 'iste' , 'eiusmodi' , 'huiusmodi' , 'idem' , 'totidem' , 'tot' ]:
184
+ af ['PronType' ].append ('Dem' )
185
+ elif node .lemma in ['alius' , 'alter' , 'solus' , 'ceterus' , 'alteruter' , 'neuter' , 'uter' ]:
186
+ af ['PronType' ].append ('Con' )
157
187
if self .flavio :
158
188
# Flavio added InflClass but not everywhere, so it is not required.
159
189
af ['InflClass' ] = ['IndEurA' , 'IndEurI' , 'IndEurO' , 'IndEurX' , 'LatPron' ]
@@ -170,8 +200,8 @@ def process_node(self, node):
170
200
rf = ['NumType' , 'NumForm' ]
171
201
af = {
172
202
'NumType' : ['Card' ],
173
- 'NumForm' : ['Word' , 'Roman' , 'Digit' ]
174
- }
203
+ 'NumForm' : ['Word' , 'Roman' , 'Digit' ],
204
+ 'Proper' : [ 'Yes' ] }
175
205
# Arabic digits and Roman numerals do not have inflection features.
176
206
if not re .match (r'^(Digit|Roman)$' , node .feats ['NumForm' ]):
177
207
af ['Gender' ] = ['Masc' , 'Fem' , 'Neut' ]
@@ -186,40 +216,40 @@ def process_node(self, node):
186
216
elif re .match (r'^(VERB|AUX)$' , node .upos ):
187
217
rf = ['VerbForm' , 'Aspect' ]
188
218
af = {
189
- 'VerbForm' : ['Inf' , 'Fin' , 'Part' ],
219
+ 'VerbForm' : ['Inf' , 'Fin' , 'Part' , 'Conv' ],
190
220
'Aspect' : ['Imp' , 'Inch' , 'Perf' , 'Prosp' ],
191
- 'Polarity' : ['Neg' ]
221
+ 'Polarity' : ['Neg' ],
222
+ 'Typo' : ['Yes' ]
192
223
}
193
- if not re . match ( r'^(Ger|Gdv)$ ' , node . feats [ 'VerbForm' ]) :
224
+ if node . feats [ 'VerbForm' ] not in [ 'Part ' , 'Conv' ] :
194
225
rf .append ('Tense' )
195
- af ['Tense' ] = ['Pres' , 'Fut' ]
196
- if node .upos == 'VERB' : # and not node.lemma.endswith('sum'): # compounds of sum
226
+ af ['Tense' ] = ['Past' , 'Pqp' , ' Pres' , 'Fut' ]
227
+ if node .upos == 'VERB' :
197
228
rf .append ('Voice' )
198
229
af ['Voice' ] = ['Act' , 'Pass' ]
199
- # Main verbs have aspect but auxiliaries don't.
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
230
if node .feats ['VerbForm' ] == 'Fin' : # imperative, indicative or subjunctive
205
231
rf .extend (['Mood' , 'Person' , 'Number' ])
206
- af ['Tense' ].extend (['Past' , 'Pqp' ])
207
232
af ['Mood' ] = ['Ind' , 'Sub' , 'Imp' ]
208
233
af ['Person' ] = ['1' , '2' , '3' ]
209
234
af ['Number' ] = ['Sing' , 'Plur' ]
210
235
elif node .feats ['VerbForm' ] == 'Part' :
211
236
rf .extend (['Gender' , 'Number' , 'Case' ])
212
- af ['Number' ] = ['Sing' , 'Plur' ]
213
- af ['Gender' ] = ['Masc' , 'Fem' , 'Neut' ]
237
+ af ['Number' ] = ['Sing' , 'Plur' ] if node . misc [ 'TraditionalMood' ] != 'Gerundium' else [ 'Sing' ]
238
+ af ['Gender' ] = ['Masc' , 'Fem' , 'Neut' ] if node . misc [ 'TraditionalMood' ] != 'Gerundium' else [ 'Neut' ]
214
239
af ['Case' ] = ['Nom' , 'Gen' , 'Dat' , 'Acc' , 'Voc' , 'Loc' , 'Abl' ]
215
240
af ['Degree' ] = ['Abs' , 'Cmp' ]
216
- af ['Gender' ] = ['Masc' , 'Fem' , 'Neut' ]
217
- af ['Tense' ].append ('Past' )
218
- # else: nothing to be added for VerbForm=Inf
241
+ if node .misc ['TraditionalMood' ].startswith ('Gerundi' ):
242
+ af ['Voice' ] = ['Pass' ]
243
+ af ['Aspect' ] = 'Prosp'
244
+ elif node .feats ['VerbForm' ] == 'Conv' :
245
+ rf .extend (['Case' , 'Gender' , 'Number' ])
246
+ af ['Case' ] = ['Abl' , 'Acc' ]
247
+ af ['Gender' ] = ['Masc' ]
248
+ af ['Number' ] = ['Sing' ]
249
+ af ['Voice' ] = ['Act' ]
250
+ elif node .feats ['VerbForm' ] == 'Inf' :
251
+ af ['Tense' ].remove ('Pqp' )
219
252
if self .flavio :
220
- # Flavio has killed Tense in his treebanks.
221
- rf = [f for f in rf if f != 'Tense' ]
222
- af ['VerbForm' ].append ('Vnoun' )
223
253
# Flavio added InflClass but not everywhere, so it is not required.
224
254
af ['InflClass' ] = ['LatA' , 'LatAnom' , 'LatE' , 'LatI' , 'LatI2' , 'LatX' ]
225
255
if 'Degree' in af :
@@ -228,23 +258,22 @@ def process_node(self, node):
228
258
af ['Degree' ] = ['Dim' ]
229
259
af ['Compound' ] = ['Yes' ]
230
260
af ['Proper' ] = ['Yes' ]
231
- if re .match (r'^(Part|Vnoun)$' , node .feats ['VerbForm' ]):
232
- af ['InflClass[nominal]' ] = ['IndEurA' , 'IndEurI' , 'IndEurO' ]
233
- af ['VerbForm' ].append ('Vnoun' )
261
+ if re .match (r'^(Part|Conv)$' , node .feats ['VerbForm' ]):
262
+ af ['InflClass[nominal]' ] = ['IndEurA' , 'IndEurI' , 'IndEurO' , 'IndEurU' ]
234
263
self .check_required_features (node , rf )
235
264
self .check_allowed_features (node , af )
236
265
# ADVERBS ##############################################################
237
266
elif node .upos == 'ADV' :
238
267
af = {
239
- 'AdvType' : ['Loc' , 'Tim' ],
268
+ 'AdvType' : ['Loc' , 'Tim' ],
240
269
'PronType' : ['Dem' , 'Int' , 'Rel' , 'Ind' , 'Neg' , 'Tot' , 'Con' ],
241
- 'Degree' : ['Pos' , 'Cmp' , 'Sup' , 'Abs' ],
270
+ 'Degree' : ['Pos' , 'Cmp' , 'Sup' , 'Abs' ],
271
+ 'NumType' : ['Card' , 'Ord' ], # e.g., primum
242
272
'Polarity' : ['Neg' ]
243
273
}
244
274
if self .flavio :
245
275
af ['Compound' ] = ['Yes' ]
246
276
af ['Form' ] = ['Emp' ]
247
- af ['NumType' ] = ['Card' , 'Ord' ] # e.g., primum
248
277
af ['VerbForm' ] = ['Part' ]
249
278
af ['Degree' ].append ('Dim' )
250
279
self .check_allowed_features (node , af )
@@ -262,7 +291,8 @@ def process_node(self, node):
262
291
elif re .match (r'^[CS]CONJ$' , node .upos ):
263
292
af = {
264
293
'PronType' : ['Rel' , 'Con' ],
265
- 'Polarity' : ['Neg' ]}
294
+ 'Polarity' : ['Neg' ],
295
+ 'Compound' : ['Yes' ]}
266
296
if self .flavio :
267
297
af ['Compound' ] = ['Yes' ]
268
298
af ['Form' ] = ['Emp' ]
@@ -271,10 +301,14 @@ def process_node(self, node):
271
301
self .check_allowed_features (node , af )
272
302
# ADPOSITIONS ##########################################################
273
303
elif node .upos == 'ADP' :
304
+ rf = ['AdpType' ]
305
+ af = {
306
+ 'AdpType' : ['Prep' , 'Post' ],
307
+ 'Abbr' : ['Yes' ]
308
+ }
274
309
if self .flavio :
275
- af = {
276
- 'VerbForm' : ['Part' ],
277
- 'Proper' : ['Yes' ]}
310
+ af ['VerbForm' ] = ['Part' ],
311
+ af ['Proper' ] = ['Yes' ]
278
312
self .check_allowed_features (node , af )
279
313
# THE REST: NO FEATURES ################################################
280
314
else :
0 commit comments