Claude commited on
Commit
831f45c
·
1 Parent(s): b81844c

feat: multi-line noise patterns — paste one per line, all saved on reject

Browse files
Files changed (1) hide show
  1. smoke_signal_tab.py +13 -6
smoke_signal_tab.py CHANGED
@@ -2707,9 +2707,16 @@ def save_review_decision(idx: int, final_text: str, action: str, noise_text_inpu
2707
  learned_pairs = 0
2708
  if action == "rejected" and str(reason).strip() == "NON_STORY_TEXT":
2709
  # Use pasted noise text if provided, otherwise fall back to raw OCR
2710
- noise_text = (str(noise_text_input or "").strip() or final_text.strip() or raw_text.strip())
2711
- if noise_text:
2712
- _save_noise_pattern(str(item.get("book_id", "")), noise_text)
 
 
 
 
 
 
 
2713
  if action == "edited":
2714
  learned_pairs = _record_punctuation_correction(
2715
  raw_text_original,
@@ -3110,9 +3117,9 @@ def smoke_signal_tab():
3110
  scale=1,
3111
  )
3112
  noise_input = gr.Textbox(
3113
- label="Paste image-noise text here (then Reject → NON_STORY_TEXT to block forever)",
3114
- placeholder="e.g. WA alle CoS lic",
3115
- lines=2,
3116
  )
3117
  reason_code = gr.Dropdown(
3118
  label="Reason code",
 
2707
  learned_pairs = 0
2708
  if action == "rejected" and str(reason).strip() == "NON_STORY_TEXT":
2709
  # Use pasted noise text if provided, otherwise fall back to raw OCR
2710
+ noise_source = str(noise_text_input or "").strip() or final_text.strip() or raw_text.strip()
2711
+ book_id_for_noise = str(item.get("book_id", ""))
2712
+ saved_count = 0
2713
+ for line in noise_source.splitlines():
2714
+ line = line.strip()
2715
+ if line:
2716
+ _save_noise_pattern(book_id_for_noise, line)
2717
+ saved_count += 1
2718
+ if saved_count == 0 and noise_source:
2719
+ _save_noise_pattern(book_id_for_noise, noise_source)
2720
  if action == "edited":
2721
  learned_pairs = _record_punctuation_correction(
2722
  raw_text_original,
 
3117
  scale=1,
3118
  )
3119
  noise_input = gr.Textbox(
3120
+ label="Paste noise patterns to block (one per line — then Reject → NON_STORY_TEXT)",
3121
+ placeholder="e.g.\nWA alle\nCoS lic\ntd wht LN",
3122
+ lines=4,
3123
  )
3124
  reason_code = gr.Dropdown(
3125
  label="Reason code",