nbrain-arabic-media-asr-qc
# `nbrain-arabic-media-asr-qc` — Arabic Clinical/Financial `ASR` Safety Scorer, `UAX#9` RTL Subtitle Fixer & Broadcast `WAV`/`MP4` QC + MCP Server
[](./LICENSE)
[](./pyproject.toml)
[](./server.json)
Engineered by **[Eng. Nadeem Mohamed Badr El-Din](https://nadeembadr.com)** at **[NBrain (`منظومة إن برين` — nbra.in)](https://nbra.in)** for Arabic medical dictation, Whisper/ASR benchmarking, streaming subtitle localization, and broadcast media pipelines.
## Modules
1. **Arabic & Clinical ASR Safety Evaluator (`WER`, `CER` + High-Risk Entity Error Rate `HREER`)**:Orthographic/diacritic-normalized Levenshtein alignment PLUS safety-critical entity verification for **dosages/numbers**, **anatomical laterality** (`يمين`/`يسار`, `right`/`left`), and **clinical negation** (`لا يوجد`/`بدون`/`no`)—catching lethal transcription flips that hide behind `<5%` WER!
2. **Streaming Arabic `SRT` Timed-Text Auditor & `UAX#9` RTL BiDi Punctuation Fixer**: Enforces `<= 17.0 CPS`, `<= 42 CPL`, duration bounds (`833ms..7000ms`), and injects `U+200F (RLM)` around trailing weak/neutral punctuation so `.` / `!` / `?` / `%` never jump to the wrong side of Arabic subtitle lines.
3. **Broadcast `RIFF/WAV` PCM Loudness & Peak Inspector + `MP4/ISOBMFF` `moov` Faststart Verifier**: Pure-stdlib binary inspection of PCM sample peaks, clipping, DC offset, RMS loudness (`dBFS`/`LUFS` proxy), and MP4 progressive-streaming `moov`-before-`mdat` atom layout.
## Quick Verification
```bash
PYTHONPATH=src python -m unittest discover -s tests -v
```
TDQS
Scored across 4 tools
Each tool targets a distinct artifact and concern: WAV audio QC, Arabic ASR safety/WER evaluation, SRT subtitle auditing/fixing, and MP4/ISOBMFF streaming checks. There is no meaningful overlap in selection intent despite all being media QC operations.
All names use snake_case and begin with an action verb, making the set predictable. The only minor deviation is the conjunction in audit_and_fix_arabic_srt_subtitles, which still reads clearly.
Four tools is well-scoped for a media ASR QC server: each covers a separate QC layer (audio, ASR output, subtitles, container) and no tool feels redundant. The count stays within the ideal 3–15 range.
The surface covers the core QC domains for Arabic media/ASR workflows: audio integrity, ASR accuracy/safety, subtitle compliance, and MP4 streaming readiness. Minor gaps exist, such as only SRT subtitle handling and no broader video/audio sync validation, but agents can work around them.