Skip to main content

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 .npy matrices 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 .

Metadata

Release files for tilavet-aligner 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tilavet-aligner 0.1.0
File Size Uploaded Provenance
tilavet_aligner-0.1.0.tar.gz 17.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tilavet-aligner 0.1.0
File Interpreter ABI Platform
tilavet_aligner-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.6 kB

Release files / tilavet_aligner-0.1.0.tar.gz

Download URL tilavet_aligner-0.1.0.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9112cf1d2c2bf3e00a8fb1f780ecbdd6077a60325dc3d6cd8de58169b593d797
BLAKE2b-256 checksum
How to use checksums
860d3d4f2fe3cb1ea2ab37c60a1595e19692a736004bc2099dbc32f1e7dfefb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / tilavet_aligner-0.1.0-py3-none-any.whl

Download URL tilavet_aligner-0.1.0-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0982f2ebf93bf7779fd4caeba26d62c0a836d03d21390261a4d11b0c1d815859
BLAKE2b-256 checksum
How to use checksums
a46379ec90dcd66a288abf0be30f2a1ffaaf010472e63f15693baee9b6bc3d83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for tilavet-aligner 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page