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.1-cp311-cp311-win_amd64.whl (62.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

kaldialign-0.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.6 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

kaldialign-0.7.1-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.1-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.1-cp310-cp310-win_amd64.whl (62.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

kaldialign-0.7.1-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.1-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.1-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.1-cp39-cp39-win_amd64.whl (62.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

kaldialign-0.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.7 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

kaldialign-0.7.1-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.1-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.1-cp38-cp38-win_amd64.whl (62.6 kB view details)

Uploaded CPython 3.8 Windows x86-64

kaldialign-0.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.5 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

kaldialign-0.7.1-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.1-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.1-cp37-cp37m-win_amd64.whl (63.3 kB view details)

Uploaded CPython 3.7m Windows x86-64

kaldialign-0.7.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82.9 kB view details)

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

kaldialign-0.7.1-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (89.2 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686

kaldialign-0.7.1-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.1-cp36-cp36m-win_amd64.whl (63.3 kB view details)

Uploaded CPython 3.6m Windows x86-64

kaldialign-0.7.1-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.1-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl (89.1 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ i686

kaldialign-0.7.1-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.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c8632dcef5c586d451d987ea03d5e674c0d91793715373965f5e812c4de918a5
MD5 15089cb75a4e31ce9282d649432413e0
BLAKE2b-256 5231a445fa5eec62b47980d0462adca4d57a838ac45f291a5e65cc9aee910dce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 445ee7d81952d4bc9c1a4ef4c42bb58f4fd5d7839e3aa2fae3e889475521c482
MD5 a611ecc1c59d6967187b7baa858b30a3
BLAKE2b-256 91c5183483e2bef6968e0beab8e04fc307bb7fad9de9410835f69b97f752d5ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 fc1d8efb20770773acfd84fed777d97262b3b819f5c114092aaffd52fa09aec9
MD5 ba1eff492ed10101718a1647d761767f
BLAKE2b-256 90b4a15e849878a25360f5dce36f74d44b6f9e26c81d0ed12fca5f2533b373cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b15b8c7df08f75c318c1eeb92479684c546ed07b75c593b18409ae9e19d30650
MD5 9561632fb4772fa40f80117d93023d86
BLAKE2b-256 2b7b4bfe1bd4194aa0d4cecb6cfd08483b93ee1215abb6d9b439d5a25aca7b7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 70d1daf82424edd8715812e45ead0c7423ac9add7fb322b44dfe28bc150cbdb8
MD5 9b6a8f81a52a1cf21f43b0677457e228
BLAKE2b-256 9c7ddf6e95af6ef3dd51b3f61c70b319a662e06f859dd31d8997da7dc7e3157c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7cc8b64868cc7542a9fd5b0ff6036e2d4c062f1cf8f46a4a29a0785e1f970a36
MD5 39a827e9d82e14dbe345140cd5b30900
BLAKE2b-256 7a4e5a7bade56338d852d827844a600712779c1ee7d1f177734b05c643c33966

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 424b312b03988954d82b469ebd0fb4a467fa0fb1ae1bcc94ad4e92487d3faa13
MD5 95984f2b6a9452688d631014eaf0ac64
BLAKE2b-256 905badf495eeb55b6c7d4e1772fc8118cc8265b42f6a15dc1aca3c679f9a22f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d6c682767120da3ff337fe1d56bf562d98a95587043e7297087b8296c4bc0d49
MD5 8076cefb2aae1354608aa7b91f2c83a2
BLAKE2b-256 6925b1143a069de968978b8caac74f82c24325cb40054a1d6978cd9446f529de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3874b407f332d1d53c301d31b036824793f8dc9a174aed99e187d5b00874a1a7
MD5 aa45514b31091c5bace59a9d3cf5351b
BLAKE2b-256 d8905c8177598e2838aca874c1888162e57f004ffd92155f54139b12ed217e02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef53b284ad933a0bb7b19603eced8836858b2dde2af9fa82dfb549bb05a08f67
MD5 2f007ad946db69933e9ce7636dd362a7
BLAKE2b-256 9e97d7553a0bd4d98be2f16526ddeaffaf86abe9209ca4dfef72c7498053a214

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 01b36fd24ce5ef04879c0bbf5711c5fe585fb924c59fa6fe0fb56bc3137a3103
MD5 d42bd8ca5bca64bd5e5e3244b22e17d5
BLAKE2b-256 dd12d0c98c6f498423849d352570792fc772dd056b4bd508435676df7a984ec8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f1e0635fcb948e75847899967876b66edab70785b06a455289ffbd696ef8cd1b
MD5 5d873b4afc1fddd6fef40cbca4d3b47a
BLAKE2b-256 ea359a51b4ad5736774016f72e93960b012a3b6da5035d111cd9a3041a31b837

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 8f1cd2e813fa5cdbc10a83aa749aca6d2bca817675c365750713818517f7defd
MD5 ef0cc4a4a55b64ab589b8b1542c6fb4f
BLAKE2b-256 cef4b42fa6306e7710e1483ae721416eb406b2cff64027dd6b1d22051291bca1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 28946f827e8077f26973097886983c5c2a45bf4f514af7c6e0a0fcde41eb160e
MD5 b544531f855a5aa0cd460cdd2ef6a06b
BLAKE2b-256 5d464f825e4087ff987d70cdbfd11daefab390ba2ae85c1d9f91f3cd40ae81d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 64355e88b21a43c6a5d4abcdb5c090c4ad0b6197664f2db49803d19968900775
MD5 1985565f1866e15f09644cd2c4a6a0b3
BLAKE2b-256 fb96a541e2fc6d7fee973ae83ede2f2268527ddf1c94375a0e964037d34f3b76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4d9e30d95f0e31796754c8810091d8dd60723b45fd5d56d207c55f21fa1b9107
MD5 5bf22a88904058ae2868182217e38c44
BLAKE2b-256 1c1e2a40427a43d5f79c12798afd4c6324bc8b74b5f73afaeff1f268c79d4a81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7e8bb512e86590c1c7b3fe004bc4b4f6959d45803969c4a9932ab52fe72cc1b4
MD5 0f15b55bdedb13bd735251cfb83c3a57
BLAKE2b-256 42cbd422c8875833331c12f74181070dd856349cf09ff1680c7d85a8418dd13f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e2748cbf8c5c3d896d3d76742211172df5b4e912e0fb946737be5858481799b
MD5 27ddaf3262a4ba5a6c58b8713404b95b
BLAKE2b-256 587a0f56fc530f6fca6d380071f2c4e8e205ed0ce4f93643a4e826cbffbe41e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 5ce5400b88daf48f4d34b36e9e7139e8c4f62f7b542b51981c02a66a58352641
MD5 517c214169faa60ef152b32523888f56
BLAKE2b-256 a791711aebfe285c4948b7dbb6e5890e96e6be1db597d343f56aadae3a7a40ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1d705f8f42c0c31e8b2705338387714d11f810617cb8e9ac01dfb92f75930dd6
MD5 6d7f86898fc9f3d564eb0e14811b7eef
BLAKE2b-256 fe992f8d27f7e6d9fe5cfd5a20c0241330e674491f42cb506af16617c78b8ac6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 b97a5d07dfd4fe327403e13f90d5c0b5a855ead75a1bebd1794234ce0d865da0
MD5 ec8229cd1aa6effc5fac396dbd61ec92
BLAKE2b-256 70fa52b055c421e502d63da0820e640a32f9ccbae4c1c94d5ddd932c547550e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ee242bdb9b769d8d3ecb8333328c9d9271f33b5f5075d66f0f87e7977dc9c4b
MD5 c7d87e03efea522e537f827ef7f0a040
BLAKE2b-256 9d15fbfdf0643bf1a3f325c9f31f80723bb48e1e6b45cb03a3359e29eb6143ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ae580f1052d4ee884849aa4646f67010c9afbf1f7cf508b39ff2f8ac08311a14
MD5 a323c49ab76af4f31475e066b57de5ba
BLAKE2b-256 5421d72d895f85acd139c35bf8e1fdfffa0420a64622676894db1289e19f376d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kaldialign-0.7.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 150abca25a907f4a5943e51aacd8249803929ea77e9b81796135dcdb4f0c67d5
MD5 aa9350353345fc9ade12bd4ac651b31d
BLAKE2b-256 43c057022b823a8501314058d37813d411356c3eddf90dbcfb85b59f2c5a87a1

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