a-v-bely commited on
Commit
4f458ed
·
1 Parent(s): 3043fa9

gender check for some lvl

Browse files
utilities_language_general/esp_utils.py CHANGED
@@ -134,7 +134,7 @@ def get_distractors_from_model(model, lemma: str, pos: str, gender: str or None,
134
  and distractor_pos in COMBINE_POS['simple'][level_name][pos] and pos in COMBINE_POS['simple'][level_name][distractor_pos])
135
  )
136
  and distractor_lemma != lemma
137
- and candidate_gender == gender
138
  and length_ratio <= max_length_ratio
139
  and distractor_lemma not in global_distractors
140
  and edit_distance(lemma, distractor_lemma) / ((len(lemma) + len(distractor_lemma)) / 2) >
@@ -210,7 +210,7 @@ def get_distractors_from_model_bert(model, text_with_masked_task: str, lemma: st
210
  and distractor_pos in COMBINE_POS['simple'][level_name][pos] and pos in COMBINE_POS['simple'][level_name][distractor_pos]))
211
  and distractor_lemma != lemma
212
  and (len(_distractors) < max_num_distractors+100)
213
- and (candidate_gender == gender)
214
  and (length_ratio <= max_length_ratio) # May be changed if case of phrases
215
  and (distractor_lemma not in global_distractors)
216
  and (edit_distance(lemma, distractor_lemma) # May be changed if case of phrases
 
134
  and distractor_pos in COMBINE_POS['simple'][level_name][pos] and pos in COMBINE_POS['simple'][level_name][distractor_pos])
135
  )
136
  and distractor_lemma != lemma
137
+ and (candidate_gender == gender and level_name in ('B1', 'B2', 'C1', 'C2'))
138
  and length_ratio <= max_length_ratio
139
  and distractor_lemma not in global_distractors
140
  and edit_distance(lemma, distractor_lemma) / ((len(lemma) + len(distractor_lemma)) / 2) >
 
210
  and distractor_pos in COMBINE_POS['simple'][level_name][pos] and pos in COMBINE_POS['simple'][level_name][distractor_pos]))
211
  and distractor_lemma != lemma
212
  and (len(_distractors) < max_num_distractors+100)
213
+ and (candidate_gender == gender and level_name in ('B1', 'B2', 'C1', 'C2'))
214
  and (length_ratio <= max_length_ratio) # May be changed if case of phrases
215
  and (distractor_lemma not in global_distractors)
216
  and (edit_distance(lemma, distractor_lemma) # May be changed if case of phrases