feat: syllabic caption localizer for 9 Indian languages with RCI accessibility scoring#29
Open
bhuvan-somisetty wants to merge 1 commit into
Open
Conversation
…ssibility scoring Signed-off-by: bhuvan-somisetty <somisettybhuvan5@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PlanetRead's CC pipeline emits English labels like
[alarm]and[tabla]regardless of what language the viewer reads. For a low-literacy Telugu student in a classroom that caption is invisible they can hear the sound but the text does not reach them.This PR adds
src/caption/localizer.py: a zero-dependency localization layer that translates every CC event into the viewer's language before it reaches the screen. Nine languages are supported: Hindi, Telugu, Tamil, Kannada, Bengali, Marathi, Gujarati, Punjabi, and English. All 25 CC labels including the India-specific ones ([tabla],[dhol],[temple bells],[firecrackers]) are translated for each language in their native script.Pipeline position
The localizer sits between the fusion engine (PR #28) and the SRT/SLS writer (PR #24).
CaptionSignalis interface-compatible with theCCDecisiondataclass from the decision engine no adapters needed.Syllabic reading unit counting
Every existing CC system BBC/FCC spec included calculates display duration from word count. That works for English but badly underestimates reading load for Indic scripts. A single Telugu compound like
హర్షధ్వానాలుspans five syllables. Counting it as "one word" gives a display time 5× too short for a low-literacy learner.This module counts aksharas: Unicode vowel nuclei (independent vowel letters + dependent vowel signs / matras) across all seven Indic script blocks. Each vowel nucleus corresponds to one syllable the real cognitive unit of reading in Indic orthography.
Reading speed is expressed in syllables per minute (SPM) calibrated per script per literacy tier:
Dravidian scripts (Telugu, Tamil, Kannada) are calibrated slower than Devanagari. Tamil sits at 100 SPM for low-literacy because its consonant cluster ligatures demand extra orthographic decoding per reading unit. Using a single shared display time is not a minor inaccuracy it systematically disadvantages the learners PlanetRead exists to serve.
Reading Complexity Index
batch_localize_with_report()returns aLocalizationReportalongside the captions. The report includes a Reading Complexity Index (RCI) per caption:RCI = 100 means even the weakest reader in that language has enough time. RCI < 60 flags content for review. The two heatmaps below show why this matters:
Left panel: when content is calibrated for low-literacy viewers, RCI is 100 across the board. Right panel: when the same content is calibrated for expert viewers, Tamil and Telugu start producing red cells captions that fluent readers can follow but low-literacy learners cannot. The RCI makes that gap measurable and actionable.
The full accessibility analysis across all 9 languages and 9 labels:
Running the demo
Public API
Tests
136 tests cover all 9 languages, all 25 labels, Unicode script detection, akshara counting for every script block, SPM floor and ceiling clamps, literacy level ordering, RCI computation,
LocalizationReportfields,batch_localize_with_reportbehavior, fallback for unknown labels and language codes, and score passthrough. CI from PR #25 runs them on Python 3.10, 3.11, and 3.12.