a-v-bely commited on
Commit
c456def
·
1 Parent(s): bdd6de8

fix morph issues

Browse files
utilities_language_general/rus_utils.py CHANGED
@@ -120,50 +120,6 @@ def make_inflection(text: str, pos: str or list, tags: set, level: str) -> str o
120
  elif 'anim' in tags:
121
  tags.discard('anim')
122
  tags.add('inan')
123
- if pos in ('NOUN', 'ADJ') and level in ('A1, A2') and rnd == 0:
124
- if 'sing' in tags:
125
- tags.discard('sing')
126
- tags.add('plur')
127
- elif 'plur' in tags:
128
- tags.discard('plur')
129
- tags.add('sing')
130
- elif pos in ('NOUN', 'ADJ') and level in ('A1', 'A2') and rnd == 1:
131
- if 'masc' in tags:
132
- tags.remove('masc')
133
- tags.add('femn')
134
- word_form = morph.parse(text)[0].inflect(tags)
135
- if word_form is not None:
136
- return word_form.word
137
- else:
138
- tags.remove('femn')
139
- tags.add('neut')
140
- word_form = morph.parse(text)[0].inflect(tags)
141
- if word_form is not None:
142
- return word_form.word
143
- if 'femn' in tags:
144
- tags.remove('femn')
145
- tags.add('masc')
146
- word_form = morph.parse(text)[0].inflect(tags)
147
- if word_form is not None:
148
- return word_form.word
149
- else:
150
- tags.remove('masc')
151
- tags.add('neut')
152
- word_form = morph.parse(text)[0].inflect(tags)
153
- if word_form is not None:
154
- return word_form.word
155
- if 'neut' in tags:
156
- tags.remove('neut')
157
- tags.add('masc')
158
- word_form = morph.parse(text)[0].inflect(tags)
159
- if word_form is not None:
160
- return word_form.word
161
- else:
162
- tags.remove('masc')
163
- tags.add('femn')
164
- word_form = morph.parse(text)[0].inflect(tags)
165
- if word_form is not None:
166
- return word_form.word
167
  else:
168
  word_form = morph.parse(text)[0].inflect(tags)
169
  return word_form.word if word_form is not None else None
 
120
  elif 'anim' in tags:
121
  tags.discard('anim')
122
  tags.add('inan')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  else:
124
  word_form = morph.parse(text)[0].inflect(tags)
125
  return word_form.word if word_form is not None else None