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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kaldingram-0.1.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kaldingram-0.1.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file kaldingram-0.1.1.tar.gz.

File metadata

  • Download URL: kaldingram-0.1.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kaldingram-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eef54c73816c6cad4a9d2522cb00a2f00101f8cc9d9306c42d8006224dd31f1a
MD5 2a7fb0f13b32f68cff10c5767c1be48a
BLAKE2b-256 8b6f603aa9f5e8048777129cc86f320c79ffca2ffe7fef41102886448cbf3ddb

See more details on using hashes here.

File details

Details for the file kaldingram-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kaldingram-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kaldingram-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d44b996866462cdb038434e5bc235ad7dd356d9dea4b9e4b84811ae3d4f8adc
MD5 d8b139cc5450272a3c45ad84117e778b
BLAKE2b-256 2709107fed74e799df572eb99bb70531d675f67ec135bbf2cf4e9ec937c4fee9

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

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