Monotonic / CTC forced-alignment helpers for the Tilavet Quran teleprompter pipeline.
Project description
Tilavet Aligner
Small MVP package for monotonic Quran phoneme alignment.
It consumes tilavet-phonemizer alignment targets:
target = Phonemizer().phonemize("رَيْبَ ۛ فِيهِ").to_alignment_dict()
and aligns frame-level phoneme log probabilities to that known target sequence. This package does not perform free ASR decoding.
MVP Modules
contract.py: validates the phonemizer alignment target JSON.posterior.py: adapts sparse JSON, dense JSON, dense logits, and optional.npymatrices to frame log-prob dictionaries.viterbi.py: aligns frame log-probabilities to target phoneme symbols, including optional blank-aware CTC mode.word_spans.py: converts symbol frame spans to word-level timestamps.ctc.py: vocabulary and frame normalization helpers.
Posterior Inputs
Sparse frame dictionaries:
[
{"a": -0.1, "b": -5.0},
{"a": -4.0, "b": -0.1}
]
Dense matrix JSON or .npy input requires a vocabulary file whose order matches
the posterior columns:
["<blank>", "a", "b"]
CLI examples:
tilavet-align target.json sparse-frames.json
tilavet-align target.json dense-logprobs.json --vocab-json vocab.json
tilavet-align target.json dense-logits.npy --vocab-json vocab.json --from-logits
tilavet-align target.json ctc-logprobs.json --ctc --blank-symbol "<blank>"
--ctc uses expanded states [blank, s0, blank, s1, ...]; blank frames do
not expand word-level symbol spans.
Output Confidence
Alignment output keeps the raw Viterbi score and adds normalized confidence
fields:
{
"score": -0.6,
"frame_count": 5,
"mean_log_prob": -0.12,
"confidence": 0.8869,
"words": [
{
"token": "ab",
"score": -0.2,
"scored_frames": 2,
"mean_log_prob": -0.1,
"confidence": 0.9048
}
]
}
In CTC mode, frame_count may include blank frames inside the timestamp span;
scored_frames counts only frames assigned to the word's target symbols.
Synthetic End-to-End Demo
With the sibling phonemizer source tree present:
PYTHONPATH=src python3 examples/synthetic_alignment.py \
--phonemizer-src "../Tilavet Phonemizer/src"
This runs:
Arabic text -> phonemizer.to_alignment_dict() -> synthetic CTC posterior -> word timestamps
It is not an acoustic-model test; it is a package-boundary smoke test.
Development
python3 -m pytest -q
python3 -m ruff check .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tilavet_aligner-0.1.0.tar.gz.
File metadata
- Download URL: tilavet_aligner-0.1.0.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9112cf1d2c2bf3e00a8fb1f780ecbdd6077a60325dc3d6cd8de58169b593d797
|
|
| MD5 |
21dd5c50ff42933a8695ab63fcf13d06
|
|
| BLAKE2b-256 |
860d3d4f2fe3cb1ea2ab37c60a1595e19692a736004bc2099dbc32f1e7dfefb4
|
File details
Details for the file tilavet_aligner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tilavet_aligner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0982f2ebf93bf7779fd4caeba26d62c0a836d03d21390261a4d11b0c1d815859
|
|
| MD5 |
8edc1faa2c1624fd185bb0f334b54a3b
|
|
| BLAKE2b-256 |
a46379ec90dcd66a288abf0be30f2a1ffaaf010472e63f15693baee9b6bc3d83
|