Skip to main content

kaldingram

kaldingram provides Python and CLI tools to:

  • train Kneser-Ney back-off n-gram language models in ARPA format
  • entropy-prune ARPA language models

The implementation is based on Kaldi WSJ scripts and matches SRILM-style behavior.

Install

pip install kaldingram

CLI Usage

Train an n-gram LM

kaldingram train --ngram-order 4 --text corpus.txt --lm 4gram.arpa

Or stream text from stdin and write ARPA to stdout:

cat corpus.txt | kaldingram train --ngram-order 3 > 3gram.arpa

Prune an n-gram LM

kaldingram prune --threshold 1e-8 --lm 4gram.arpa --write-lm 4gram_pruned.arpa

Evaluate perplexity

kaldingram ppl --lm 4gram.arpa --text test.txt
cat test.txt | kaldingram ppl --lm 4gram.arpa

Development

Build package locally:

python -m pip install --upgrade build
python -m build

Metadata

Release files for kaldingram 0.1.2

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

Source distribution (sdist)

Source distribution for kaldingram 0.1.2
File Size Uploaded Provenance
kaldingram-0.1.2.tar.gz 21.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kaldingram 0.1.2
File Interpreter ABI Platform
kaldingram-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 45.3 kB

Release files / kaldingram-0.1.2.tar.gz

Download URL kaldingram-0.1.2.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
73bedc61348cb89661fe2de008c174aa79fce3127efe4b215108570914222126
BLAKE2b-256 checksum
How to use checksums
8bdc5b34747f60d087b35b12fe6bc99985629a341508dfde20ee95b58b305403
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / kaldingram-0.1.2-py3-none-any.whl

Download URL kaldingram-0.1.2-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
348fa8e6cd1ec9a09afc75f5df3857f11381ec88b0898d654f2246e5895b3666
BLAKE2b-256 checksum
How to use checksums
56f1b1d682e97e0f3b9773ec5c5ee47617d72be868aad807119c1c5be3a21b0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for kaldingram 0.1.2

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.

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