RJ3vans commited on
Commit
8d57803
·
verified ·
1 Parent(s): 58c9ced

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -2496,7 +2496,7 @@ def process_text(input_text):
2496
  f"ABORT: exceeded {MAX_ITERS} iterations; "
2497
  f"draining {len(working_set)} item(s) to final"
2498
  )
2499
- while working_set:
2500
  sentence_final.append(
2501
  clean_output(working_set.popleft())
2502
  )
@@ -2608,6 +2608,8 @@ def process_text(input_text):
2608
  xml_tag,
2609
  )
2610
  simps = simplifier(xml_sent)
 
 
2611
 
2612
  # Residual comma → same conjunction (CCV / CMV1 / CMN1 / CLN only)
2613
  if (
@@ -2638,12 +2640,14 @@ def process_text(input_text):
2638
  print(
2639
  "Simplifier returned []; forcing final (no re-queue)"
2640
  )
 
2641
  sentence_final.append(current)
2642
  continue
2643
 
2644
  queued_any = False
2645
  for s in simps:
2646
  plain_s = clean_output(s)
 
2647
  if not plain_s:
2648
  continue
2649
  plain_key = re.sub(r"\s+", " ", plain_s.lower())
@@ -2652,7 +2656,6 @@ def process_text(input_text):
2652
  f" No progress (same as input): "
2653
  f"{plain_s[:80]}..."
2654
  )
2655
- plain_s = fix_subject_verb_agreement(plain_s)
2656
  sentence_final.append(plain_s)
2657
  continue
2658
  if plain_key in seen:
 
2496
  f"ABORT: exceeded {MAX_ITERS} iterations; "
2497
  f"draining {len(working_set)} item(s) to final"
2498
  )
2499
+ while working_set:
2500
  sentence_final.append(
2501
  clean_output(working_set.popleft())
2502
  )
 
2608
  xml_tag,
2609
  )
2610
  simps = simplifier(xml_sent)
2611
+ if simps:
2612
+ simps = [fix_subject_verb_agreement(s) for s in simps]
2613
 
2614
  # Residual comma → same conjunction (CCV / CMV1 / CMN1 / CLN only)
2615
  if (
 
2640
  print(
2641
  "Simplifier returned []; forcing final (no re-queue)"
2642
  )
2643
+ current = fix_subject_verb_agreement(current)
2644
  sentence_final.append(current)
2645
  continue
2646
 
2647
  queued_any = False
2648
  for s in simps:
2649
  plain_s = clean_output(s)
2650
+ plain_s = fix_subject_verb_agreement(plain_s)
2651
  if not plain_s:
2652
  continue
2653
  plain_key = re.sub(r"\s+", " ", plain_s.lower())
 
2656
  f" No progress (same as input): "
2657
  f"{plain_s[:80]}..."
2658
  )
 
2659
  sentence_final.append(plain_s)
2660
  continue
2661
  if plain_key in seen: