Commit d6100285f8a9227d9687b4f2d865d897ddd287bf
1 parent
48b729c4
Poprawki związane z listami atrybutów w wynikach Morfeusza
Showing
1 changed file
with
10 additions
and
8 deletions
semantics/phraseology_generator.py
... | ... | @@ -204,7 +204,7 @@ def get_adjps(cases, number, gender, degree, adjectives, atr): |
204 | 204 | filtered = [] |
205 | 205 | for option in options: |
206 | 206 | (orth, tag) = option |
207 | - if u':' + gender + u':' in tag or u'.' + gender + u':' in tag or u':' + gender + u'.' in tag or u'.' + gender + u'.' in tag: | |
207 | + if u':' + gender + u':' in tag or u'.' + gender + u':' in tag or u':' + gender + u'.' in tag or u'.' + gender + u'.' in tag or u'.' + gender + u':' in tag: | |
208 | 208 | filtered.append(option) |
209 | 209 | options = filtered |
210 | 210 | if degree != u'_': |
... | ... | @@ -258,7 +258,7 @@ def get_numps(cases, numerals, nouns, atr): |
258 | 258 | filtered = [] |
259 | 259 | for option in options: |
260 | 260 | (orth, tag) = option |
261 | - if u':' + case + u':' in tag or ':' + case + '.' in tag or '.' + case + '.' in tag: | |
261 | + if u':' + case + u':' in tag or u':' + case + u'.' in tag or u'.' + case + u'.' in tag or u'.' + case + u':' in tag: | |
262 | 262 | filtered.append(option) |
263 | 263 | options_temp += filtered |
264 | 264 | else: |
... | ... | @@ -278,15 +278,17 @@ def get_numps(cases, numerals, nouns, atr): |
278 | 278 | options = filtered |
279 | 279 | if rec == 'rec': |
280 | 280 | c = ['gen'] |
281 | - else: | |
281 | + elif rec == 'congr': | |
282 | 282 | c = cases |
283 | + else: | |
284 | + c = list(set(['gen'] + cases)) | |
283 | 285 | options_temp = [] |
284 | 286 | for case in c: |
285 | 287 | if case != u'_': |
286 | 288 | filtered = [] |
287 | 289 | for option in options: |
288 | 290 | (orth, tag) = option |
289 | - if u':' + case + u':' in tag or ':' + case + '.' in tag or '.' + case + '.' in tag: | |
291 | + if u':' + case + u':' in tag or u':' + case + u'.' in tag or u'.' + case + u'.' in tag or u'.' + case + u':' in tag: | |
290 | 292 | filtered.append(option) |
291 | 293 | options_temp += filtered |
292 | 294 | else: |
... | ... | @@ -294,9 +296,9 @@ def get_numps(cases, numerals, nouns, atr): |
294 | 296 | options = options_temp |
295 | 297 | for (orth, tag) in options: |
296 | 298 | gender = tag.split(':')[3] |
297 | - if u':' + gender + u':' in num_tag or ':' + gender + '.' in num_tag or '.' + gender + '.' in num_tag: | |
299 | + if u':' + gender + u':' in num_tag or u':' + gender + u'.' in num_tag or u'.' + gender + u'.' in num_tag or u'.' + gender + u':' in num_tag: | |
298 | 300 | results.append(num_orth + ' ' + orth) |
299 | - | |
301 | + | |
300 | 302 | return results #ignoring ambiguos atr for numps |
301 | 303 | |
302 | 304 | def get_prepnumps(prep, cases, numerals, nouns, atr): |
... | ... | @@ -312,7 +314,7 @@ def get_verb(inf, number, is_subj): |
312 | 314 | filtered = [] |
313 | 315 | for option in options: |
314 | 316 | (orth, tag) = option |
315 | - if u'fin:' in tag and u':' + number + ':' in tag and u':ter:' in tag: | |
317 | + if u'fin:' in tag and u':' + number + u':' in tag and u':ter:' in tag: | |
316 | 318 | filtered.append(option) |
317 | 319 | options = filtered |
318 | 320 | return [orth for orth, _ in options] |
... | ... | @@ -338,7 +340,7 @@ def phrase(head, dependents): |
338 | 340 | type = sortatributes(argument)[0].values.all()[0].argument.type |
339 | 341 | value, _ = lexicalisation(argument, False, '', False, head) |
340 | 342 | values += value |
341 | - if type == 'adjp': | |
343 | + if type == u'adjp': | |
342 | 344 | modifiers['pre'].append(values) |
343 | 345 | else: |
344 | 346 | modifiers['post'].append(values) |
... | ... |