- Add _wake_sleeping_space() helper that checks Space runtime status via
HF API and polls until RUNNING before connecting
- Add 'could not fetch config' to retryable error keywords
- Increase retries from 3 to 5 and delays from 2-8s to 10-30s to handle
cold starts (~30-90s)
- Mark 'could not fetch config' as transient to prevent permanent caching
Fixes ValueError: Could not fetch config when Space is sleeping on
free cpu-basic hardware (48h inactivity timeout)
fix: use env var HF_TOKEN instead of hf_token kwarg for gradio_client compatibility
- Added visual divider lines to Chrome extension logos (Popup, Sidepanel, Inline)
- Synchronized light/dark theme toggle across all extension views via chrome.storage.local
- Fixed sidepanel theme variables to ensure responsive toggle
- Re-ordered z-index for login overlay to ensure it covers the editor
- Improved punctuation rules with a Smart Colon Guard that checks 6 words back for speech cues and perfectly retains colons even for long subjects
fix: swap punctuation rules for colons to prevent strict guard conflicts
The colon guard only stripped colons from ال-prefixed words, missing
preposition+definite combos like لل (للطالبة:). This fixes PC037 where
a hallucinated colon after a speech verb's indirect object survived
postprocessing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NEW PIPELINE STEP after spelling, before grammar:
1. Trailing و removal (from legacy AraSpell):
- المصنعو→المصنع, الماهرينوومن→الماهرينوومن
- Catches PC004, PC008, PC010 benchmark failures
2. Edit-distance-1 OOV→IV correction:
- For remaining OOV words, find closest IV word in BERT vocab
- Only replaces when edit-1 candidate exists and first letter matches
- Catches: صممو→صمموا (PC001), حضرو→حضروا (PC042)
Also adds contextual_corrector.py module (MLM-based validation).
Tests: 39 passing.
The بال...ون/ان and ل...ون/ان patterns had no blocklist protection.
بالامتحان would become بالامتحين, للإنسان would become للإنسين.
Now all three preposition regexes use the same callback with:
- _PREP_BLOCKLIST check
- ان suffix → skip (almost always root noun form)
Tests: 39 passing (10 new for FIX-33b).
FIX-36: Merge punctuation into grammar when they overlap same span
When grammar fixes المعلمون→المعلمين at [18:26] and punctuation
wants المعلمون→المعلمين. at the same [18:26], the overlap resolver
was dropping the punctuation entirely. Now detects that the punctuation
correction is grammar_correction + trailing punct char, and merges them
into a single suggestion: المعلمون→المعلمين.
This preserves both the grammar fix AND the terminal period.
FIX-33: Grammar rules fix_prepositions_advanced was corrupting
الامتحان→الامتحين. The regex blindly replaced ان→ين after prepositions,
but الامتحان is a root noun not a dual. Added blocklist of ~60 common
root-form nouns and skip all ال-prefixed words ending in ان.
FIX-34: Remove auto-re-analysis from Apply All in editor.js.
When spelling and grammar disagree (spelling strips ذهبن→ذهب,
grammar re-adds ذهبوا→ذهبن), the auto-re-analysis creates an
infinite loop of contradictory suggestions.
FIX-35: Spelling no longer strips valid conjugation suffixes.
The insertion fix was accepting ذهبن→ذهب (removing final ن) as
'extra char removed'. But ن is a feminine plural verb suffix.
Now blocks removal of suffix chars (ن,ت,ا,ي,ة,و,ه) from word
endings, preventing spelling from undoing grammar corrections.
FIX-31: .rstrip() before checking trailing punct regex — model may
output trailing whitespace after hallucinated dots, breaking the
dollar-sign anchor.
Log fix: Grammar and Punctuation service logs were hardcoding '...'
after [:80] truncation even for short texts. This made it appear
that the models were adding ellipsis when they weren't. Now only
appends '...' when text is actually >80 chars.
Phase 14b: Fix spelling punct hallucination + cross-stage overlap
FIX-31: Strip trailing punctuation (... . etc) hallucinated by the
AraSpell model that wasn't in the input. This prevents dot
accumulation across pipeline runs.
PatchSet: Spelling + Punctuation patches from different stages now
always coexist (they're compatible corrections). Previously,
punctuation's higher priority caused spelling patches on
adjacent/overlapping words to be dropped ('فيالمشروع' phantom).
- StageLocker: Grammar now only blocked by spelling locks when >50%
of the grammar diff falls INSIDE the spelling lock. Previously,
any boundary touch (even 1 char) blocked grammar entirely.
This fixes the Collision Dataset bug (32% pass rate) where
spelling locks bled into adjacent words and blocked grammar.
- PatchSet: Relaxed overlap resolution — patches with <50% overlap
of the smaller patch are allowed to coexist. This prevents
punctuation patches from dropping spelling patches on adjacent words.
Both fixes verified with unit tests.
Merge punctuation_rules V1+V2: V2 threshold+fallback, V1 softened exclamation guard for short texts
FIX-28a: Digit guard in bidirectional spelling path
- Numbers (2020, 150) were OOV→IV hallucinated into Arabic words
- Root cause: bidirectional fix had no digit protection
FIX-28b: Prefix-swap guard in bidirectional path
- فبالتالي→وبالتالي leaked through (same stem, prefix swap)
FIX-29: Exclamation mark guard in punctuation rules
- PuncAra added ! to declarative sentences (التاريخ→التاريخ!)
- Now only allows !/؟ when text has exclamatory cue words
FIX-30: Prefix-stripping protection in spelling filter
- وبالمستشفيات→والمستشفيات (stripped ب from compound prefix)
- Blocks corrections that strip compound prefixes (وبال, فبال, etc.)
Adversarial diagnostic: 83.3% pass (30/36), 6 failures identified
Full benchmark: 320 tests across 8 datasets, 55% overall pass rate
Previously Rule 0c only rejected rearrangement (same punct chars in
different positions). Now also rejects substitution (comma→colon,
comma→semicolon) when the alphabetic content is unchanged.
Live tested: Fixes P013 (أحمد، كيف→أحمد كيف:) and H026
(الأمم، وبدونه→الأمم وبدونه؛). P012 and P015 already fixed.