Kaldifst is a Python wrapper for the OpenFst library, a widely used C++ library for creating, manipulating, and performing operations on Finite State Transducers (FSTs) and Finite State Automata (FSAs). It is commonly used in speech recognition (e.g., Kaldi). As of version 1.8.0, it maintains an active release cadence, frequently updating with minor versions to address build fixes, performance improvements, and new features.
pip install kaldifstVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a simple FST from a string, print its representation, apply common FST operations like determinization and minimization, and find the shortest path within it. The `from_str` method provides a convenient way to define FSTs for testing or simple cases.
If you need to preserve the original FST, make an explicit copy before performing operations that modify it, e.g., `new_fst = kaldifst.Fst(original_fst)` or `new_fst = original_fst.copy()` if available.
Ensure a clear understanding of FST semirings. For most graph-shortest-path type problems, `StdArc` (tropical semiring) is appropriate. For probability computations, the log semiring is often used. Explicitly choose and understand your semiring.
Always use the pre-built wheels if possible. If building from source, ensure your OpenFst C++ library version is compatible with the `kaldifst` version's requirements, or allow `kaldifst` to build its own bundled OpenFst dependencies.
No dependency data recorded yet.