Skip to main content

A pure-python finite state transducer library with support for AT&T files and flag diacritics

Project description

KFST

KFST is a finite state transducer library written in pure Python. It supports reading transducers from AT&T tabular format files. In addition to standard features, it also supports flag diacritics.

The intended use case is to use KFST in environments in which native libraries like HFST cannot be installed.

Installation

KFST is available on PyPI and can be installed with pip:

pip install kfst

Usage

In this example, we assume that you have a transducer stored in the file my-transducer.att. You can easily create such file using the HFST toolkit:

hfst-fst2txt -f att my-transducer.hfst > my-transducer.att

Reading transducers

Transducers can be read from AT&T tabular format files using the read_att function:

from kfst import FST

fst = FST.read_att_file("my-transducer.att")

Using the transducer

To run the transducer, use the lookup method, which returns a list of tuples of the form (output, weight) sorted by weight:

fst.lookup("foo")

License

KFST is licensed under the GNU LGPL version 3 or later. See the LICENSE file for details.

Project details


Download files

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

Source Distribution

kfst-1.0.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

kfst-1.0.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file kfst-1.0.2.tar.gz.

File metadata

  • Download URL: kfst-1.0.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for kfst-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ba1e64e81f8ebd748aeb8e694bb6bf1cd1e738840dd1d6365e7a936d24524995
MD5 c208a8be780de6e0d0512828c1a372d1
BLAKE2b-256 f98323cb3aed4402c9d84b6248dfc4d45f81210d3a293f7856c2718bf8b1dace

See more details on using hashes here.

File details

Details for the file kfst-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: kfst-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for kfst-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a8bc41a670ceae3d6b3c5dfe18d59b0bc7b58efdf67adc7b23b7e952b9a904a3
MD5 991c33781c738efcb0bdb7c22f3e5b05
BLAKE2b-256 aac500342be460f84c468d9e20e5f7ffd1f1b2387180b6ba3c46e647b0ac1326

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