Bayan AI commited on
Commit
72df81e
·
1 Parent(s): 3da743f

Fix: Allow gender prefix swap (ي/ت) during feminine plural present tense bypass

Browse files
Files changed (1) hide show
  1. src/app.py +6 -4
src/app.py CHANGED
@@ -2101,10 +2101,12 @@ def analyze_text():
2101
  elif (corr_text.endswith('ن') and corr_text[:-1] == orig_text
2102
  and len(orig_text) >= 3):
2103
  _is_grammar_pattern = True
2104
- # Present tense fem plural: ون → ن (يلعبون → يلعبن)
2105
- elif (orig_text.endswith('ون') and corr_text.endswith('ن') and
2106
- orig_text[:-2] == corr_text[:-1] and len(orig_text) >= 3):
2107
- _is_grammar_pattern = True
 
 
2108
  # Present tense masc plural: يفعل→يفعلون (adding ون)
2109
  elif (corr_text.endswith('ون') and corr_text[:-2] == orig_text
2110
  and len(orig_text) >= 3):
 
2101
  elif (corr_text.endswith('ن') and corr_text[:-1] == orig_text
2102
  and len(orig_text) >= 3):
2103
  _is_grammar_pattern = True
2104
+ # Present tense fem plural: ون → ن (يلعبون → يلعبن or يلعبون → تلعبن)
2105
+ elif (orig_text.endswith('ون') and corr_text.endswith('ن') and len(orig_text) >= 3):
2106
+ _o_stem = orig_text[:-2]
2107
+ _c_stem = corr_text[:-1]
2108
+ if _o_stem == _c_stem or (len(_o_stem) > 1 and _o_stem[1:] == _c_stem[1:] and _o_stem[0] in 'يت' and _c_stem[0] in 'يت'):
2109
+ _is_grammar_pattern = True
2110
  # Present tense masc plural: يفعل→يفعلون (adding ون)
2111
  elif (corr_text.endswith('ون') and corr_text[:-2] == orig_text
2112
  and len(orig_text) >= 3):