bayan-api / src /nlp /grammar

Commit History

fix: wake sleeping HF Space before Gradio Client connection
c15c00a
Running

youssefreda9 commited on

fix: use env var HF_TOKEN instead of hf_token kwarg for gradio_client compatibility
cfddf82

youssefreda9 commited on

feat: add HF_TOKEN auth to Gradio Client to fix rate limiting
01f9c42

youssefreda9 commited on

Fix grammar JSON spacing bug
b4e2427

youssefreda9 commited on

Fix structural regressions
e7b2a51

youssefreda9 commited on

Fix: 10 critical NLP logic bugs in grammar, spelling, and punctuation to prevent false positives
41ea30b

youssefreda9 commited on

Fix plural adjective agreement regression for broken plurals
e7c1175

youssefreda9 commited on

Fix 30 NLP edge cases in Grammar, Spelling, and Punctuation (Phase 10 results and Extension UI improvements)
be32617

youssefreda9 commited on

fix(grammar): add hamza fixes for ايضا, اول, and position-aware إنّ/أنّ rules
7078e93

youssefreda9 Claude Opus 4.6 commited on

update benchmark logs
a84aad9

youssefreda9 commited on

Fix collision benchmark failures: patch overlap mapping, tokenization guard, and rule hallucinations
df5e501

youssefreda9 commited on

Fix punctuation alignment and hallucinations, add punctuation safety rules, add kana/inna grammar rules
9786f39

youssefreda9 commited on

feat(nlp): implement case-checking rules for kana and inna sisters using camel_tools
1519f71

youssefreda9 commited on

Add debugging scripts and fix grammar/punctuation logic
ce14862

Bayan AI commited on

fix: verb suffix stripping, regex unnormalized hamzas, and POS-independent triggers to reach 70%
4ec5188

Bayan AI commited on

refactor: simplify architecture and replace whitelists with CamelTools
ebd15e7

Bayan AI commited on

Fix: Enhance Jazm and Nasb logic with camel_tools for Af'al Khamsa and defective verbs
b3209ae

Bayan AI commited on

FIX-38/39 + Layer 1/2/3: Benchmark normalization + spelling safety + grammar rules
79db738

youssefreda9 commited on

FIX-33b: Protect second+third preposition regexes with blocklist
c6dd3fa

youssefreda9 commited on

FIX-33/34/35: Fix infinite loop — grammar corruption + spelling conflict
03cd504

youssefreda9 commited on

Fix grammar rules output log — remove hardcoded ... truncation marker
09be182

youssefreda9 commited on

Phase 14c: Fix FIX-31 whitespace bug + fix misleading log truncation
80c9b7b

youssefreda9 commited on

Fix: TerminalPunctuationGuard for short phrases and comprehensive Nasb/Jazm grammar rules fixes
76b9ec3

Bayan AI commited on

Feat: Add demonstrative and noun-adjective dual/plural agreement rules
daf0945

Bayan AI commited on

Fix: Prevent conditional sentences rule from overcorrecting 'إن' and 'من' by requiring the subsequent word to be a verb
d7619b9

Bayan AI commited on

Fix: Preserve input punctuation during grammar correction
db7d7d8

Bayan AI commited on

HOTFIX: Remove broad preposition/nasb regex rules — caused Hallucination 0%, +38 FP
4bb9b89

youssefreda9 commited on

Critical: Isolate grammar rules in try/except so regex fallback ALWAYS runs
524d4e0

youssefreda9 commited on

Phase 13: Grammar SV/gender whitelist, preposition/nasb regex, pronoun-h guard
00b99d9

youssefreda9 commited on

Phase 12: Fix 6 batches — grammar pipeline bypass, religious/structured protection, punct rearrangement, SV/gender agreement
81c58cc

youssefreda9 commited on

Phase 11: Master Bug Fix — 23 fixes across 8 files
bfc07c3

youssefreda9 commited on

Phase 8: Fix all critical bugs from adversarial validation
76ea593

youssefreda9 commited on

fix(critical): stop spelling from corrupting correct words + fix pronoun agreement + reject hallucinations
7e24e70

youssefreda9 commited on

fix: all model bugs — S1 S2 S3 G1 P1 (6 fixes across 4 files)
bc71395

youssefreda9 commited on

fix: Grammar Gradio client retry with exponential backoff (3 attempts, 2s/4s/8s)
75e46c4

youssefreda9 commited on

fix: Grammar retry on rate-limit + cursor position after correction
a52b4fe

youssefreda9 commited on

fix: Grammar rules false positive - الامتحان was incorrectly matched - Increased minimum stem length from 2 to 4 in fix_prepositions_advanced - Prevents root-level ان endings (الامتحان, الإنسان) from being treated as grammatical ون/ان
773412e

youssefreda9 commited on

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

youssefreda9 commited on

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

youssefreda9 commited on

fix: Remove 'Apply All' button - conflicts with spelling+grammar pipeline
7f0ddc6

youssefreda9 commited on

fix: Word-level grammar suggestions + robust grammar model validation
b0bed28

youssefreda9 commited on

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

youssefreda9 commited on

revert: Restore ORIGINAL grammar params that were working (num_beams=4, max_length=512) - Remove all hallucination checks that were blocking valid corrections - The model WAS correcting ذهب→ذهبت before, only highlight was wrong - Keep word-level diff fix (in app.py) + raw output logging
9eee80b

youssefreda9 commited on

fix: Switch grammar to greedy decoding + stronger anti-hallucination - num_beams=1 (greedy, most stable for seq2seq correction) - repetition_penalty=2.0 (strong anti-repeat) - Log raw model output before hallucination check - Tightened bigram duplicate detection
ea6d242

youssefreda9 commited on

fix: Prevent grammar model hallucination (rearranging/duplicating text) - Dynamic max_length (1.3x input instead of fixed 512) - repetition_penalty=1.5 to discourage repeating - Reduce beams 4→2 (less hallucination on CPU) - Add _is_hallucinated() safety checker: output length, word count, repeated phrases, sentence rearrangement
964adc9

youssefreda9 commited on

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

youssefreda9 commited on