Skip to main content

Kaldi alignment methods wrapped into Python

Project description

kaldialign

A small package that exposes edit distance computation functions from Kaldi. It uses the original Kaldi code and wraps it using pybind11.

Installation

conda install -c kaldialign kaldialign

or

pip install --verbose kaldialign

or

pip install --verbose -U git+https://github.com/pzelasko/kaldialign.git

or

git clone https://github.com/pzelasko/kaldialign.git
cd kaldialign
python3 -m pip install --verbose .

Examples

  • align(seq1, seq2, epsilon) - used to obtain the alignment between two string sequences. epsilon should be a null symbol (indicating deletion/insertion) that doesn't exist in either sequence.
from kaldialign import align

EPS = '*'
a = ['a', 'b', 'c']
b = ['a', 's', 'x', 'c']
ali = align(a, b, EPS)
assert ali == [('a', 'a'), ('b', 's'), (EPS, 'x'), ('c', 'c')]
  • edit_distance(seq1, seq2) - used to obtain the total edit distance, as well as the number of insertions, deletions and substitutions.
from kaldialign import edit_distance

a = ['a', 'b', 'c']
b = ['a', 's', 'x', 'c']
results = edit_distance(a, b)
assert results == {
    'ins': 1,
    'del': 0,
    'sub': 1,
    'total': 2
}
  • For both of the above examples, you can pass sclite_mode=True to compute WER or alignments based on SCLITE style weights, i.e., insertion/deletion cost 3 and substitution cost 4.

Motivation

The need for this arised from the fact that practically all implementations of the Levenshtein distance have slight differences, making it impossible to use a different scoring tool than Kaldi and get the same error rate results. This package copies code from Kaldi directly and wraps it using Cython, avoiding the issue altogether.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

kaldialign-0.7-cp311-cp311-win_amd64.whl (62.6 kB view details)

Uploaded CPython 3.11 Windows x86-64

kaldialign-0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.5 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

kaldialign-0.7-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (88.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

kaldialign-0.7-cp311-cp311-macosx_10_9_x86_64.whl (54.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

kaldialign-0.7-cp310-cp310-win_amd64.whl (62.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

kaldialign-0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.5 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

kaldialign-0.7-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (88.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

kaldialign-0.7-cp310-cp310-macosx_10_9_x86_64.whl (54.4 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

kaldialign-0.7-cp39-cp39-win_amd64.whl (62.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

kaldialign-0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

kaldialign-0.7-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (88.5 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

kaldialign-0.7-cp39-cp39-macosx_10_9_x86_64.whl (54.5 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

kaldialign-0.7-cp38-cp38-win_amd64.whl (62.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

kaldialign-0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.4 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

kaldialign-0.7-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (88.5 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

kaldialign-0.7-cp38-cp38-macosx_10_9_x86_64.whl (54.4 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

kaldialign-0.7-cp37-cp37m-win_amd64.whl (63.2 kB view details)

Uploaded CPython 3.7m Windows x86-64

kaldialign-0.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.8 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

kaldialign-0.7-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (89.1 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686

kaldialign-0.7-cp37-cp37m-macosx_10_9_x86_64.whl (54.6 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

kaldialign-0.7-cp36-cp36m-win_amd64.whl (63.2 kB view details)

Uploaded CPython 3.6m Windows x86-64

kaldialign-0.7-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.8 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

kaldialign-0.7-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl (89.0 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ i686

kaldialign-0.7-cp36-cp36m-macosx_10_9_x86_64.whl (54.6 kB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file kaldialign-0.7-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e572a5fa19360bf4eb8c243fdc167d881fa6cfffc98187da4812ea90c43dc992
MD5 5eb6391ed4a1dba509077f117427860b
BLAKE2b-256 0c6a67bafc727a9ebd0f8fe5f2f20680681f24add193055b03194ac8b8b56f98

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4ec7acb604dbd32d69968b2cccb01beb5067795badc8d9367756d4f9667d2f2
MD5 2134d9e769bdfe1c737501cd8d343783
BLAKE2b-256 508a5957c34615daeeb084d5032ec7c3f0a081d09b37754715c1194be364fc11

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 3e9c7590c86a89977d5cfc33ca351032cc70649936f01e6f4c8f39cd9ad91938
MD5 4d5a0d69b6b25f37f803c45998ef2494
BLAKE2b-256 7720ddd6959a3c42ddc59f941325c528dc907e31c921767d7379b14ae5a827c9

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 585ec65f15bc5d5d2a9588aa8d7320762cc6114e09d998ac949a0a73b57dfbc8
MD5 525d7a51b9ba4c2bb99aa17939993c6b
BLAKE2b-256 4199a20fe3c656f1ae95fba45f769049bb0575ff728f776e889a3078ac4e88a2

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 985eaadd15f201b34363ed5086be8230db87cef51e96a69fc07c5e4d979699e6
MD5 15787ad96eddbffba95c8f4019c058a3
BLAKE2b-256 5633f6487658cbbb2788f9ecdefaeb37b2a2633e530e946b1ba185cc14de8b4a

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 125b43ef98c0d773e3b06d68810427bdc05b382166016b5674786c131065fd74
MD5 9cdba970e3cd03148e9d3e70a230f7f8
BLAKE2b-256 3594f0876dd0eebc4f54b9e37fa943d075a3558c36a04762a7a9b1a5b6ae01b2

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 84a51e36001416049199a59da17b7fe7cbe638b16635ca4955272bdd50c3f108
MD5 22c81adbae5612c41a181097335d8ffe
BLAKE2b-256 0c3da1ea35a1d7a23ebae7d748017edba9273676adabff88d7e93ffd6a5f4052

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 56c3f2b4fa57cfaf531da605eb46f988730d3476d3a2e7e66a011a624331ed70
MD5 8b9424790e75b50caf1a2c817bafb321
BLAKE2b-256 92a9ac551f3812de315f471efb7587da7dca413bdf218ae387e67bc000660dfc

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: kaldialign-0.7-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 62.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for kaldialign-0.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4aeccdacab282cfa600d8a8dac7e6dd7b43b3047f3d1435c35433928afcdfc3d
MD5 653d111d333a5b6d137db62305d77094
BLAKE2b-256 517ae94db53914d4977e781f33621d620b7d8878e418176e12c1bc66a36fb2a5

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 951b5d82e7ab8d55d7a0dcb7a81890389b644ae4dd9c2b55aaa8fb608e8f982e
MD5 2f05c01f5e27307d5af2e0657c8e316c
BLAKE2b-256 dd6c39cfdb2883a8cecf36780f8e7169050c243195b49c1c810f88ba234dfbfd

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 85ff0243127c99a13379c91048ea3aba949df0bfd90cfd103e304247b09f557c
MD5 fe4ccf8bd04bb636cc1e72477228b2ec
BLAKE2b-256 5e7ab9e154b67aa6bd990f797b1122a2d1278f5aa172c373ce08ea42ff609e97

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e8fb5a77814a79ba0bc0d40b3d3d1d8c8de17b920847a394a32db156e94b5ced
MD5 9e63f966766aaa83969131d75b569863
BLAKE2b-256 c7795541c295aa14b389bd8f3e457f6e10bc3cd3c6eff5a65c8a511fc729d948

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: kaldialign-0.7-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for kaldialign-0.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 a464cfead01fb597b9ca814e4eddc0eeb09779ce740d63a3dddf8e9a17b94339
MD5 27782cc7d504a44180bbf0454a381a45
BLAKE2b-256 b35089169ac20ee69dfda308b254d8b76c33516f69b9f2d3316e6cfc44bc4ffa

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e97b7c255549ae3dc079432087ba1d8b92e9f38f8ea1add474cb23311ec28f0c
MD5 b5cafbe7036010bb94df12e92c74ed8b
BLAKE2b-256 64c68091880748543f15723bed30b148dae016400f70bd0e26aba5faa4782f3f

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 2d448647e4969b3ab1809b32b4580585f4d278228de0bd22afda37e18d59bf88
MD5 ad4a80663e456a72d0c48b525819de29
BLAKE2b-256 f90f68c656cbfc687d0a7717d79c9418459023c983aa6a004e9c103b9a1daf56

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 284580cd6f8e57ee86035f2052988fd7fc160e4944618541639d0d288a1d9d0c
MD5 7d462ea89cfd09e09be5be3ae766c44d
BLAKE2b-256 e3c874e810cd930c0b4bb068aadef85bf60ae2ca9918bc0e95b915906e57fb87

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: kaldialign-0.7-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 63.2 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for kaldialign-0.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 007982d787ea42191aab356d545ce14f690f1c3e02ad242f7bedace5493337fb
MD5 395442c328b9a084f9d4454e973f9de5
BLAKE2b-256 661de1c511ac0b5e01eebb710dab120a3a234f6a2e104b20edd3b0f949c038f5

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7d265326c77c8fe1e67ba6bcef1ab78dde0cde23661294089406330a787987b
MD5 5ad253b753de3563d0752fcef18e60cc
BLAKE2b-256 dbc28003ab58f078333cec9842ac1e17b6b76d4dda25a0466a72600483651aaf

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7346c1afd2df25c95a1f177dcc000c09b04bee300ed3f072b6ed5fd43e968d95
MD5 25396d28f2ad415e021333a37bda656b
BLAKE2b-256 4264cf2d6a0f39838e833cec158688dae29ce3c93bdac1b4ef2653786128f6ef

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 30c3a82db5181350669d055930669bed72a507006f9a52079b0f78cf89db0fa2
MD5 7528c07c255a5a0a08dd2423488c8534
BLAKE2b-256 7efd0cab892fc9839dbec3f636411cc769d37888c6d3a43053798ec722941571

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: kaldialign-0.7-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 63.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for kaldialign-0.7-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ad10360a27132c91fc2c7e8da78eb9215c48c0491046906565f8ae85419f4c56
MD5 dacfb1ef8f20027b03a60a7ab418cebd
BLAKE2b-256 f7206af9b0ad3b0242afc9742d4bc5c1d41d462328ef96e291dd1f6082cd79e9

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ea1768a582c5aff3c729399202f4cf6bd1b0e9ffc0a42173ec91342df6bb283
MD5 2d190dd53d154dfb37803c2680841da2
BLAKE2b-256 130c96de6009809d11501a0107c17c39fbdb6377a00a1ff9d33b41a323cd089e

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e5b236cd15d7f60dabbb60d4fab2295a61e85c6e7feb28e862e7bed3dba25113
MD5 5371b6c65f382096dc018ca5090b2b39
BLAKE2b-256 dc7eb2cf5f4e8804a182d2487fe40fd2914f5b33e57fb1eeba6f7c2d32670931

See more details on using hashes here.

File details

Details for the file kaldialign-0.7-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 00b8749c63f274415bf79da55540f44cb7b3a97bf4df782bdc7b1e860c5444c5
MD5 8fcb91a0be75f0234da0ed250c51a838
BLAKE2b-256 4653d5b9942b53be086f7b430cf9ee93ab9ad5c0a3445614691df3d1846a879d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page