A pure python IO interface for data accessing in kaldi
Project description
Kaldi Python IO
A python (3.6+) wrapper for kaldi's data accessing.
Support Type
- kaldi's binary archives (*.ark)
- kaldi's scripts (alignments & features, *.scp)
- kaldi nnet3 data examples in binary (*.egs)
Install
python setup.py install
or pip install kaldi_python_io
Usage
-
ArchiveReader && AlignArchiveReader
# allow only sequential index ark_reader = ArchiveReader("copy-feats ark:foo.ark ark:- |", matrix=True) for key, _ in ark_reader: print(key) ali_reader = AlignArchiveReader("gunzip -c foo.ali.gz |") for key, _ in ark_reader: print(key)
-
Nnet3EgsReader
# allow only sequential index egs_reader = Nnet3EgsReader("foo.egs") for key, _ in egs_reader: print("{}".format(key))
-
ArchiveWriter
with ArchiveWriter("foo.ark", "foo.scp") as writer: for i in range(10): mat = np.random.rand(100, 20) writer.write("mat-{:d}".format(i), mat)
-
ScriptReader && AlignScriptReader
# allow sequential/random index scp_reader = ScriptReader("shuf foo.scp | head -n 2", matrix=True) for key, mat in scp_reader: print("{}: {}".format(key, mat.shape)) ali_reader = AlignScriptReader("foo.ali.scp") for key, ali in ali_reader: print("{}: {}".format(key, ali.shape))
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
kaldi-python-io-1.0.1.tar.gz
(8.1 kB
view hashes)
Built Distribution
Close
Hashes for kaldi_python_io-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a533859f566093a6c39ae42d0521b50a64a969d8d07af609cd639456060f1145 |
|
MD5 | 66be7b91beb5f27716a98fe8a9e35506 |
|
BLAKE2b-256 | 1076c87eabe01bb7b7fd3bda4b9a0e1cf5b5c72559da1697d3463d06e8eda14b |