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,7 +204,7 @@ def get_adjps(cases, number, gender, degree, adjectives, atr): | ||
204 | filtered = [] | 204 | filtered = [] |
205 | for option in options: | 205 | for option in options: |
206 | (orth, tag) = option | 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 | filtered.append(option) | 208 | filtered.append(option) |
209 | options = filtered | 209 | options = filtered |
210 | if degree != u'_': | 210 | if degree != u'_': |
@@ -258,7 +258,7 @@ def get_numps(cases, numerals, nouns, atr): | @@ -258,7 +258,7 @@ def get_numps(cases, numerals, nouns, atr): | ||
258 | filtered = [] | 258 | filtered = [] |
259 | for option in options: | 259 | for option in options: |
260 | (orth, tag) = option | 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 | filtered.append(option) | 262 | filtered.append(option) |
263 | options_temp += filtered | 263 | options_temp += filtered |
264 | else: | 264 | else: |
@@ -278,15 +278,17 @@ def get_numps(cases, numerals, nouns, atr): | @@ -278,15 +278,17 @@ def get_numps(cases, numerals, nouns, atr): | ||
278 | options = filtered | 278 | options = filtered |
279 | if rec == 'rec': | 279 | if rec == 'rec': |
280 | c = ['gen'] | 280 | c = ['gen'] |
281 | - else: | 281 | + elif rec == 'congr': |
282 | c = cases | 282 | c = cases |
283 | + else: | ||
284 | + c = list(set(['gen'] + cases)) | ||
283 | options_temp = [] | 285 | options_temp = [] |
284 | for case in c: | 286 | for case in c: |
285 | if case != u'_': | 287 | if case != u'_': |
286 | filtered = [] | 288 | filtered = [] |
287 | for option in options: | 289 | for option in options: |
288 | (orth, tag) = option | 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 | filtered.append(option) | 292 | filtered.append(option) |
291 | options_temp += filtered | 293 | options_temp += filtered |
292 | else: | 294 | else: |
@@ -294,9 +296,9 @@ def get_numps(cases, numerals, nouns, atr): | @@ -294,9 +296,9 @@ def get_numps(cases, numerals, nouns, atr): | ||
294 | options = options_temp | 296 | options = options_temp |
295 | for (orth, tag) in options: | 297 | for (orth, tag) in options: |
296 | gender = tag.split(':')[3] | 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 | results.append(num_orth + ' ' + orth) | 300 | results.append(num_orth + ' ' + orth) |
299 | - | 301 | + |
300 | return results #ignoring ambiguos atr for numps | 302 | return results #ignoring ambiguos atr for numps |
301 | 303 | ||
302 | def get_prepnumps(prep, cases, numerals, nouns, atr): | 304 | def get_prepnumps(prep, cases, numerals, nouns, atr): |
@@ -312,7 +314,7 @@ def get_verb(inf, number, is_subj): | @@ -312,7 +314,7 @@ def get_verb(inf, number, is_subj): | ||
312 | filtered = [] | 314 | filtered = [] |
313 | for option in options: | 315 | for option in options: |
314 | (orth, tag) = option | 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 | filtered.append(option) | 318 | filtered.append(option) |
317 | options = filtered | 319 | options = filtered |
318 | return [orth for orth, _ in options] | 320 | return [orth for orth, _ in options] |
@@ -338,7 +340,7 @@ def phrase(head, dependents): | @@ -338,7 +340,7 @@ def phrase(head, dependents): | ||
338 | type = sortatributes(argument)[0].values.all()[0].argument.type | 340 | type = sortatributes(argument)[0].values.all()[0].argument.type |
339 | value, _ = lexicalisation(argument, False, '', False, head) | 341 | value, _ = lexicalisation(argument, False, '', False, head) |
340 | values += value | 342 | values += value |
341 | - if type == 'adjp': | 343 | + if type == u'adjp': |
342 | modifiers['pre'].append(values) | 344 | modifiers['pre'].append(values) |
343 | else: | 345 | else: |
344 | modifiers['post'].append(values) | 346 | modifiers['post'].append(values) |