Commit 6fcb679ee7db6dee640dcfd41e8bde47b6ad31eb

Authored by janek37
1 parent af148b01

poprawki do generowania rdzenia

Showing 1 changed file with 7 additions and 3 deletions
dictionary/models.py
... ... @@ -730,16 +730,20 @@ def filter_visible(lexemes, user):
730 730  
731 731 def get_root(basic_form, pattern, gender, use_pattern_ending=False):
732 732 ends = []
  733 + basic_endings = []
733 734 if gender:
734 735 bfl = gender.basic_form_label
735 736 basic_endings = pattern.endings.filter(base_form_label=bfl)
736   - if basic_endings:
737   - ends += [
738   - e.string for e in pattern.endings.filter(base_form_label=bfl)]
  737 + elif pattern.type.lexical_class.symbol == 'v':
  738 + basic_endings = pattern.endings.filter(base_form_label__symbol='5')
  739 + elif pattern.type.lexical_class.symbol == 'num':
  740 + basic_endings = pattern.endings.filter(base_form_label__symbol='1')
739 741 else:
740 742 use_pattern_ending = True
741 743 if use_pattern_ending:
742 744 ends.append(pattern.basic_form_ending)
  745 + else:
  746 + ends += [e.string for e in basic_endings]
743 747 good_ends = [end for end in ends if basic_form.endswith(end)]
744 748 assert len(set(good_ends)) <= 1 # inaczej rdzeń nie jest jednoznaczny
745 749 if good_ends:
... ...