# kaldi-adapt-lm
Adapt Kaldi-ASR nnet3 chain models from Zamia-Speech.org to a different language model.
Constructive comments, patches and pull-requests are very welcome.
Tutorial
To create the language model we would like to adapt our kaldi model to, we first need to create a set of sentences. To get started, download and uncompress a generic set of sentences for you language, e.g.
wget ‘http://goofy.zamia.org/zamia-speech/misc/sentences-en.txt.xz’ unxz sentences-en.txt.xz
now suppose the file utts.txt contained the sentences you would like the model to recognize with a higher probability than the rest. To achieve that, we add these sentences five times in this examples to our text body:
cat utts.txt utts.txt utts.txt utts.txt utts.txt sentences-en.txt >lm.txt
we also want to limit our language model to the vocabulary the audio model supports, so let’s extract the vocabulary next:
MODEL=”models/kaldi-generic-en-tdnn_sp-latest” cut -f 1 -d ‘ ‘ ${MODEL}/data/local/dict/lexicon.txt >vocab.txt
with those files in place we can now train our new language model using KenLM:
lmplz -o 4 –prune 0 1 2 3 –limit_vocab_file vocab.txt –interpolate_unigrams 0 <lm.txt >lm.arpa
Now we can start the kaldi model adaptation process:
kaldi-adapt-lm ${MODEL} lm.arpa mymodel
You should now be able to find a tarball of the resulting model inside the work subdirectory.
Links
<http://kaldi-asr.org/> [Kaldi ASR]
<https://zamia-speech.org> [Zamia Speech]
Requirements
Python 2
Kaldi ASR
License
My own code is Apache-2.0 licensed unless otherwise noted in the script’s copyright headers.
Metadata
Release files for kaldi-adapt-lm 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kaldi-adapt-lm-0.1.3.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kaldi_adapt_lm-0.1.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / kaldi-adapt-lm-0.1.3.tar.gz
| Download URL | kaldi-adapt-lm-0.1.3.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81a094adee4d27e22e7a6877d4cdd0c9948a70c69fac2822e7a7fb5f22cb2bc1
|
|
BLAKE2b-256 checksum How to use checksums |
4110ea00fb6ed3ef886b6f3e31dc1e8fb9adda5fce4eb1f33fc23288ca8d1aff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.6.0 setuptools/2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.5
|
Release files / kaldi_adapt_lm-0.1.3-py2.py3-none-any.whl
| Download URL | kaldi_adapt_lm-0.1.3-py2.py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
108fb4ee444188095fb74569daa01e95b4de66af47405d0670b6e23b2b95a74a
|
|
BLAKE2b-256 checksum How to use checksums |
1e45b253ce5673905b0ff1772b16a3f3160bf39fb94e947fa08d83bf611e7650
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.6.0 setuptools/2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.5
|