Skip to main content

Python bindings for k2

Project description

k2py

Python bindings for k2

Features

  • Efficient Streaming Decoding: OnlineDenseIntersecter for real-time forced alignment
  • Cross-Platform: Supports Linux, macOS, and Windows
  • Python 3.10+: Compatible with modern Python versions
  • Built with pybind11: Fast C++ bindings with minimal overhead

Installation

From PyPI

pip install k2py

Usage

Basic Example

from k2py import OnlineDenseIntersecter, CreateFsaVecFromStr
import numpy as np

# Create FSA from string representation
fsa_str = "0 1 1 1.0\n1 2 2 1.0\n2"
result = CreateFsaVecFromStr(fsa_str, final_state=2)

# Initialize decoder
decoder = OnlineDenseIntersecter(
    result["fsa"],
    result["aux_labels"],
    search_beam=20.0,
    output_beam=8.0,
    min_active_states=30,
    max_active_states=10000
)

# Prepare acoustic scores (num_frames x vocab_size)
scores = np.random.randn(100, 50).astype(np.float32)

# Decode
lattice = decoder.DecodeWithArray(scores, return_lattice=True)

# Get final alignment result
alignment = decoder.Finish()
print(f"Token IDs: {alignment['token_ids']}")
print(f"Timestamps: {alignment['timestamps']}")
print(f"Durations: {alignment['durations']}")

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

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

k2py-0.2.4-cp314-cp314-win_amd64.whl (313.1 kB view details)

Uploaded CPython 3.14Windows x86-64

k2py-0.2.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (476.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

k2py-0.2.4-cp314-cp314-macosx_15_0_arm64.whl (312.5 kB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

k2py-0.2.4-cp313-cp313-win_amd64.whl (304.0 kB view details)

Uploaded CPython 3.13Windows x86-64

k2py-0.2.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (476.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

k2py-0.2.4-cp313-cp313-macosx_15_0_arm64.whl (312.3 kB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

k2py-0.2.4-cp312-cp312-win_amd64.whl (304.0 kB view details)

Uploaded CPython 3.12Windows x86-64

k2py-0.2.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (475.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

k2py-0.2.4-cp312-cp312-macosx_15_0_arm64.whl (312.2 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

k2py-0.2.4-cp311-cp311-win_amd64.whl (303.0 kB view details)

Uploaded CPython 3.11Windows x86-64

k2py-0.2.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (474.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

k2py-0.2.4-cp311-cp311-macosx_15_0_arm64.whl (311.9 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

k2py-0.2.4-cp310-cp310-win_amd64.whl (302.4 kB view details)

Uploaded CPython 3.10Windows x86-64

k2py-0.2.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (473.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

k2py-0.2.4-cp310-cp310-macosx_15_0_arm64.whl (311.0 kB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file k2py-0.2.4-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: k2py-0.2.4-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 313.1 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for k2py-0.2.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 858a85259325cecf1df5e3d8cca089b93a0bb82de79f0e911227bb89827abcaf
MD5 7cf27ef8cd5af7981a40b82d61732170
BLAKE2b-256 c31e4f5f2983a83e40f3df75df8c3f0b8c519695b49bc6ba901f28606c17befa

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp314-cp314-win_amd64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8c3aa7de4522f5f8d894bece3ef4a3538f6a94a9bfaf548c9c711d3b5a9f3a2e
MD5 5a19b96acf3b13b72fafb63c63a2c65f
BLAKE2b-256 6a79c29191f1acb327d4a2a34f4d3cfa27bed27877ca51bbda2936846c2579af

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 86bd23d11e27ceb5590fb966cebf4268f14a246910ba5630343c148819fb3a95
MD5 92cfe83590c706aab610c3d30e7670cc
BLAKE2b-256 82049bf7b6dcbb82dca77153fc0060d11e47f8dad5bb579aae13a64e96e8aece

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp314-cp314-macosx_15_0_arm64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: k2py-0.2.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 304.0 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for k2py-0.2.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a9732331e882a02e8e87c13f93aab9431f5427fdf4e33e2bd4d2465161ea114a
MD5 7158d3da39ae32f0713c0bb127fd0d71
BLAKE2b-256 b7484c722770e709b51596cccfd6620cb62ebcf04d85176ca4ed4e867510e26a

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp313-cp313-win_amd64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eccf432c01f2fa8e257e31f7eaf161ebbb383020496aca506fad863a56379104
MD5 4658f1286a04953baf686949822c9d09
BLAKE2b-256 049751cf643fadefb1db54aa1bb81d57d74adabf1a9fdb7f952312f0f2330e82

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b5bbab7a8c4ce52d5f27d1f63c5590bd4e22f7da235defb11f06787c4ee8ad47
MD5 d686fa0f6dd0840a15efededdbcc25db
BLAKE2b-256 620f4dd8655ba6bea5e2874c94347c6368f697f73e52f57f86136e9f9fa089e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: k2py-0.2.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 304.0 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for k2py-0.2.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4765cdf86f53902c11da6650fb826894749b0fc58d244628cc05396caedf772f
MD5 ed4a51788f7d0ace6f606c1103fe4dd5
BLAKE2b-256 f29f283c8b4748231d70d2a658b169f0704a7878acd7cb5ce997a589b8210cba

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp312-cp312-win_amd64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a1d7063b6336194c6c1af10103516f6f28ee32f21a05ff781fc17e0b6ecacf07
MD5 9ec7068c77f953654df5f76eaffeaa6a
BLAKE2b-256 70312ad45525f8a5e539f217c528d76b018d21578c536df0960b5bed8ba49795

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 102ed9168963338b455cbb11ecc1cb31854e964647d734c4cf1022b2afbbee95
MD5 f7dd754134c4b1dad98094d5a83351c5
BLAKE2b-256 7f896f7ed9deb47d4842cd0c2a31eaafaabdd3a7d78c155740ca8f5731254c71

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: k2py-0.2.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 303.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for k2py-0.2.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1089a916f7809f580df8f6d4808e17faefef6a0f8376342821123977f8722f14
MD5 fabbac4207ba2d6c0e49f20296a2c2e0
BLAKE2b-256 d81f4f1f867b86ee63ec8a57be2f1e18e4a5e87f7e828267d0eee7d65a31d18b

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp311-cp311-win_amd64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c7745efe0be6178aa7a2d4f22537ca7f8b03a8e5b6824fff87a7dc3524315f2
MD5 d8d352c6a424bc2a224ce512d3f2d985
BLAKE2b-256 f9a87e90c146e05fc9f9a33e922d2aeaebe88c842ee2dc69a0b0ad48e4544932

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d89457d9662e41ef1ae690897f86ec33d11ec65a4e391ebac200b37065eb9854
MD5 acebbaae0aa8a5d79f8def308878a13e
BLAKE2b-256 4f84fa0dbf45154f2e6175832f070ab5ff3499b2ae5df27c22ad12a7fe9fdca7

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: k2py-0.2.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 302.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for k2py-0.2.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b096ca678a36c4cbb278292c92d2e9c2c5fcbdba7c2bdfc7ac799281018db694
MD5 a86a24880ac0f61b699c9c398d04ce24
BLAKE2b-256 1235bc1c40e4f04078a35b0ee642f4fe1f954b1b3c52298bd7c841e7f97999f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp310-cp310-win_amd64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aec260169c1898e983a822daeb63e8df4e94aa87bb4219ae13f9999632fd83e8
MD5 c1543d62a1e65d9ae2af51a68175e69c
BLAKE2b-256 42fccade65b294f480d0dd97a6d226e4da76857507594d920cfffe91ccf68617

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file k2py-0.2.4-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for k2py-0.2.4-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1cb95fe14492dda08920a84feabacd99c4cb0f009d060dafa822f97fbd67de31
MD5 346b995c34001a4bbb740504f5ed7ead
BLAKE2b-256 ad82f16e947dbb3d678dac36a6dc99ef92ccad42a0a21fe385de310005639a4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for k2py-0.2.4-cp310-cp310-macosx_15_0_arm64.whl:

Publisher: publish-wheels.yml on lattifai/k2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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