bayan-api / src /app.py

Commit History

  1. feat: dialect-to-MSA conversion — backend API + frontend + Docker model cache

    7b67137
  2. fix: better quran import error logging to diagnose HF failure

    d46a23d
  3. feat: Quran verification & translation endpoint + modal UI (13 languages)

    0c80121
  4. revert: restore backend to 1a76471, keep all UI/UX improvements

    9e51f9d
  5. revert: restore backend/model files to cf07939 state, keep UI/UX changes only

    143c028
  6. fix: accept ص↔س/ض↔ظ/ذ↔ز spelling corrections (المدرصة→المدرسة), fix punctuation dup regex

    7f9c54f
  7. fix: grammar/quran icons different, tooltip no strikethrough, punctuation no duplicate dots

    7d889f4
  8. UI: nav logo, bayyinah hover, quran icon, hero autocomplete shadow, clean tooltip, fix punctuation dup + hamza كان

    20a34f1

  1. fix: block grammar كان→كأن + punctuation mid-word split (الدفت.ر)

    08a99f9
  2. feat: P1-P3 all 8 items - ta marbuta fix, UI feedback, caching, rate limiting, unit tests

    918deb4
  3. fix: block grammar model from removing/normalizing punctuation marks

    de7e7ce
  4. feat: P1-P3 improvements + auto re-analyze after apply⁠

    a2f1290
  5. fix: Pipeline hardening - 37 bugs + 10 edge cases (Round 1 + Round 2)⁠

    acba693
  6. fix(spelling): strict ortho-only filter prevents word corruption⁠

    e0bf168
  7. debug(punctuation): enhanced lock logging to show which owner blocks punctuation⁠

    bd94153
  8. fix(punctuation): allow pure punctuation changes through stage lock⁠

    c98b613
  9. feat(autocomplete): threshold=0.05 + max 3 suggestions⁠

    bf57d15
  10. fix(autocomplete): true context awareness - GPT-2 now adds own candidates + cache key uses 5 words

    e9527e6
  11. feat(NLP-4): AutoComplete integration — hybrid bigram + GPT-2⁠

    d27ee08
  12. fix(critical): stop spelling from corrupting correct words + fix pronoun agreement + reject hallucinations⁠

    7e24e70
  13. fix: re-label grammar spelling fixes + handle prefix in hamza whitelist

    8f13258
  14. fix: all model bugs — S1 S2 S3 G1 P1 (6 fixes across 4 files)⁠

    bc71395
  15. fix: QA sweep — 6 issues resolved (sidebar chips, corrected field, input sanitization, punc cap, docs, tests)⁠

    10ec354
  16. feat: Pipeline Hardening v3.3 — stage ownership, punctuation safety, UUID migration⁠

    a1c20fd

  1. feat: NLP-3.5 Hardening Sprint — Performance + Overlap Resolver TASK 2: Per-stage timing instrumentation (spelling_ms, grammar_ms, punctuation_ms, total_ms) TASK 3: Smart text processing — skip AraSpell for texts > 300 chars TASK 4+5: Global overlap resolver with priority system grammar(3) > punctuation(2) > spelling(1) > autocomplete(0) Full span collision detection (exact + partial overlaps) TASK 6: AutoComplete priority hook prepared (priority=0)

    920c24b
  2. feat: NLP-3 PuncAra-v1 Integration — Local punctuation model - Created src/nlp/punctuation/ package (rules + service) - Extracted from PuncAra.py: preprocessing, postprocessing, chunking logic - PunctuationChecker: lazy-loaded EncoderDecoderModel from bayan10/PuncAra-v1 - Wired into /api/analyze as Step 3 (Spelling -> Grammar -> Punctuation) - Updated /api/punctuation standalone endpoint - Updated /api/health to report punctuation status - Dockerfile pre-downloads PuncAra-v1 weights during build - Increased gunicorn timeout to 300s for full pipeline

    92557ee
  3. fix: Deduplicate spelling/grammar overlap - grammar wins - When spelling and grammar both flag the same word position, keep only grammar suggestion - Prevents double-highlighting on conjugation errors like يعملوا

    976652b
  4. feat: NLP-2 Grammar Integration — dependency-aware pipeline - Add grammar_rules.py (ArabicGrammarGuard from Grammer_Rules.py with camel-tools) - Add grammar_service.py (lazy-loaded Gradio Client + rules pipeline) - Wire /api/grammar endpoint to real grammar service - Wire /api/analyze Step 2 to grammar (receives AraSpell output) - Update /api/health to report grammar status - Add gradio_client to requirements.txt - Add camel_data download to Dockerfile - Frontend unchanged (already supports grammar-error yellow highlighting)

    39f0dd8
  5. feat: Professional editor UI redesign - 3-column layout (docs | editor | sidebar) - Documents panel always visible on desktop - Import/export moved to left sidebar - Removed CTA button from nav - Replaced all emojis with SVG icons - Clean toolbar with separator - Mobile: docs stay as overlay sidebar

    b57e9cf
  6. fix: Remove 'Apply All' button - conflicts with spelling+grammar pipeline

    7f0ddc6
  7. fix: Word-level grammar suggestions + robust grammar model validation⁠

    b0bed28
  8. fix: Proper grammar suggestion generation — keep spelling suggestions, add grammar on top⁠

    63587df
  9. fix: Add missing SequenceMatcher import

    0f10098
  10. fix: Rewrite suggestion system — unified diff eliminates text duplication - Instead of mapping grammar offsets back through OffsetMapper (broken), now: - Run full pipeline: spelling -> grammar -> punctuation - Do ONE clean diff: original_text vs final_text - Classify each change as spelling/grammar based on what spelling changed - Guarantees non-overlapping suggestions with correct offsets

    1a2449a
  11. fix: Prevent overlapping spelling+grammar suggestions from duplicating text - Backend: Skip grammar suggestions that overlap with existing spelling ranges - Frontend: applyAllSuggestions skips overlapping ranges to prevent duplication

    02d51b7
  12. debug: Add grammar diff logging to diagnose missing suggestions

    7520375
  13. fix: Grammar shows word-level suggestions instead of sentence chunks - Break grammar diffs into individual word changes - Skip grammar suggestions overlapping with spelling - Add alternatives to grammar suggestions - Prevents duplication on Apply All

    291a28f
  14. feat: NLP-2 Grammar model integration (Bayan_Arabic_Grammar T5) - New: src/nlp/grammar/grammar_service.py (lazy T5 loading) - Dockerfile: pre-download grammar model (2.14GB safetensors) - Wire /api/analyze Step 2 to grammar service - Update /api/grammar standalone endpoint - Add _grammar_available() health check

    4ec8363

  1. feat: Show 3 spelling alternatives + keep-as-is option - Backend: Generate alternatives via EditDistanceCorrector - Tooltip: Multiple clickable correction buttons - Sidebar cards: Alt chips for each suggestion - Dismiss button removes error highlight (keep original word)

    3f8001b
  2. fix: Handle N-to-M word replacements in analyze post-filter - Process each original word individually against corrected segment - Accept 1-to-1 small edits and 1-to-N word splits within multi-word blocks - Previously all multi-word blocks were silently rejected

    d1f18ad
  3. fix: Relax analyze post-filters to show AraSpell corrections in editor - Allow 3 char edits (was 2), 50% ratio (was 40%) - Lower word-split threshold from 12 to 5 chars

    6d70738
  4. feat: Wire /api/analyze to use AraSpell service for real-time editor spelling

    bf32528
  5. fix: Remove duplicate /api/spelling route causing AssertionError

    738185d
  6. feat: Add AraSpell spelling correction endpoint (POST /api/spelling) with lazy model loading - Extract AraSpell pipeline into src/nlp/spelling/ (araspell_rules.py + araspell_service.py) - Pre-download AraBERT encoder-decoder + checkpoint in Dockerfile - Lazy load on first request, contextual=False to save RAM - Update health check to report spelling status

    53f433b
  7. fix: Always load models on import (RENDER/GUNICORN_LOADED env vars not set in HF Spaces)

    ccf3eef
  8. debug: Add startup error tracking + memory info to debug endpoint

    756045d
  9. fix: Load summarization model locally with float16 (HF free tier has no outbound DNS)⁠

    d229a9c
  10. fix: Add wait_for_model, debug endpoint, and better HF API error handling

    2df4f2d
  11. feat: Switch all NLP models to HuggingFace Inference API⁠

    239c0bb

  1. authDone Ready for deployment

    bb51619