Spaces:
Sleeping
Sleeping
togokah
commited on
Commit
·
384d7d5
1
Parent(s):
7c98e23
Fix inflection in bert
Browse files
pages/2_👨🏫_Начало_работы.py
CHANGED
@@ -81,7 +81,7 @@ if st.session_state.get('-LOGGED_IN_BOOL-'):
|
|
81 |
with COL2:
|
82 |
UPLOAD_CLOUD_CEFR_LEVEL = custom_select_box(
|
83 |
'Выберите языковой уровень',
|
84 |
-
['A1', 'A2', 'B1', 'B2', 'C1', 'C2', '
|
85 |
no_selection_label='-Выберите языковой уровень-')
|
86 |
st.session_state['-UPLOAD_CLOUD_CEFR_LEVEL-'] = UPLOAD_CLOUD_CEFR_LEVEL
|
87 |
LOAD_BUTTON = LOAD_FORM.form_submit_button('Загрузить')
|
|
|
81 |
with COL2:
|
82 |
UPLOAD_CLOUD_CEFR_LEVEL = custom_select_box(
|
83 |
'Выберите языковой уровень',
|
84 |
+
['A1', 'A2', 'B1', 'B2', 'C1', 'C2', 'Без уровня'],
|
85 |
no_selection_label='-Выберите языковой уровень-')
|
86 |
st.session_state['-UPLOAD_CLOUD_CEFR_LEVEL-'] = UPLOAD_CLOUD_CEFR_LEVEL
|
87 |
LOAD_BUTTON = LOAD_FORM.form_submit_button('Загрузить')
|
utilities_language_bert/esp_sentence_bert.py
CHANGED
@@ -220,11 +220,11 @@ class TASK:
|
|
220 |
if distractor_lemma.count('_') > 1:
|
221 |
if distractor_lemma.startswith('haber_'):
|
222 |
distractor_lemma = distractor_lemma.split('_')[-2]
|
223 |
-
inflected = inflect(lemma=distractor_lemma, target_pos=self.pos, target_tags=self.tags)
|
224 |
else:
|
225 |
continue
|
226 |
else:
|
227 |
-
inflected = inflect(lemma=distractor_lemma, target_pos=self.pos, target_tags=self.tags)
|
228 |
if inflected is not None:
|
229 |
inflected_distractors.append(inflected)
|
230 |
num_distractors = min(4, self.max_num_distractors) if self.max_num_distractors >= 4 \
|
|
|
220 |
if distractor_lemma.count('_') > 1:
|
221 |
if distractor_lemma.startswith('haber_'):
|
222 |
distractor_lemma = distractor_lemma.split('_')[-2]
|
223 |
+
inflected = inflect(lemma=distractor_lemma, target_pos=self.pos[1], target_tags=self.tags)
|
224 |
else:
|
225 |
continue
|
226 |
else:
|
227 |
+
inflected = inflect(lemma=distractor_lemma, target_pos=self.pos[1], target_tags=self.tags)
|
228 |
if inflected is not None:
|
229 |
inflected_distractors.append(inflected)
|
230 |
num_distractors = min(4, self.max_num_distractors) if self.max_num_distractors >= 4 \
|
utilities_language_general/esp_utils.py
CHANGED
@@ -184,12 +184,7 @@ def get_distractors_from_model_bert(model, text_with_masked_task: str, lemma: st
|
|
184 |
max_num_distractors: int, max_length_ratio=5, min_edit_distance_ratio=0.5):
|
185 |
_distractors = []
|
186 |
try:
|
187 |
-
|
188 |
-
bert_candidates = [token for token in model(text_with_masked_task,
|
189 |
-
top_k=max_num_distractors + 100,
|
190 |
-
targets=list(distractor_minimum))]
|
191 |
-
else:
|
192 |
-
bert_candidates = [token for token in model(text_with_masked_task, top_k=max_num_distractors + 100)]
|
193 |
candidates = []
|
194 |
for candidate in bert_candidates:
|
195 |
if isinstance(candidate, list):
|
|
|
184 |
max_num_distractors: int, max_length_ratio=5, min_edit_distance_ratio=0.5):
|
185 |
_distractors = []
|
186 |
try:
|
187 |
+
bert_candidates = [token for token in model(text_with_masked_task, top_k=max_num_distractors + 100)]
|
|
|
|
|
|
|
|
|
|
|
188 |
candidates = []
|
189 |
for candidate in bert_candidates:
|
190 |
if isinstance(candidate, list):
|