# KFST
KFST is a finite state transducer library written in pure Python. It supports reading transducers from [AT&T tabular format](https://github.com/hfst/hfst/blob/master/doc/transducer-representations-formats.rst) files and its own binary format.
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:
```sh
hfst-fst2txt -f att my-transducer.hfst > my-transducer.att
# if you want a kfst file:
python -m kfst.convert my-transducer.att my-transducer.kfst
```
### Reading transducers
Transducers can be read from AT&T tabular format files using the `read_att_file` function, and the KFST binary format using the `read_kfst_file` function:
```python
from kfst import FST
fst = FST.read_att_file("my-transducer.att")
# or
fst = FST.read_kfst_file("my-transducer.kfst")
```
### 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:
```python
fst.lookup("foo")
```
## License
KFST is licensed under the GNU LGPL version 3 or later. See the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/fergusq/fst-python",
"name": "kfst",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Iikka Hauhio",
"author_email": "iikka.hauhio@helsinki.fi",
"download_url": "https://files.pythonhosted.org/packages/53/e6/e601542b9d266ae7a872bdd85d8a01711d10b7a9bf4be2c90d8479098a7e/kfst-4.0.0.tar.gz",
"platform": null,
"description": "# KFST\n\nKFST is a finite state transducer library written in pure Python. It supports reading transducers from [AT&T tabular format](https://github.com/hfst/hfst/blob/master/doc/transducer-representations-formats.rst) files and its own binary format.\nIn addition to standard features, it also supports flag diacritics.\n\nThe intended use case is to use KFST in environments in which native libraries like HFST cannot be installed.\n\n## Installation\n\nKFST is available on PyPI and can be installed with pip:\n\n```\npip install kfst\n```\n\n## Usage\n\nIn this example, we assume that you have a transducer stored in the file `my-transducer.att`.\nYou can easily create such file using the HFST toolkit:\n\n```sh\nhfst-fst2txt -f att my-transducer.hfst > my-transducer.att\n\n# if you want a kfst file:\npython -m kfst.convert my-transducer.att my-transducer.kfst\n```\n\n### Reading transducers\n\nTransducers can be read from AT&T tabular format files using the `read_att_file` function, and the KFST binary format using the `read_kfst_file` function:\n\n```python\nfrom kfst import FST\n\nfst = FST.read_att_file(\"my-transducer.att\")\n# or\nfst = FST.read_kfst_file(\"my-transducer.kfst\")\n```\n\n### Using the transducer\n\nTo run the transducer, use the `lookup` method, which returns a list of tuples of the form `(output, weight)` sorted by weight:\n\n```python\nfst.lookup(\"foo\")\n```\n\n## License\n\nKFST is licensed under the GNU LGPL version 3 or later. See the LICENSE file for details.\n",
"bugtrack_url": null,
"license": "GNU LGPLv3 or later",
"summary": "A pure-python finite state transducer library",
"version": "4.0.0",
"project_urls": {
"Bug Tracker": "https://github.com/fergusq/fst-python/issues",
"Homepage": "https://github.com/fergusq/fst-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e4c2f33a8213c85d120a237e33b0e1709715e067e4bcc72bbbb9e869554247c9",
"md5": "1dcb734bf3be5df5409bc25d7b52b9fa",
"sha256": "857977262558268fccd7767e952bb11d488ed8bd8a466c33655299d47b060ea5"
},
"downloads": -1,
"filename": "kfst-4.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1dcb734bf3be5df5409bc25d7b52b9fa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14502,
"upload_time": "2023-10-23T13:21:48",
"upload_time_iso_8601": "2023-10-23T13:21:48.323260Z",
"url": "https://files.pythonhosted.org/packages/e4/c2/f33a8213c85d120a237e33b0e1709715e067e4bcc72bbbb9e869554247c9/kfst-4.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "53e6e601542b9d266ae7a872bdd85d8a01711d10b7a9bf4be2c90d8479098a7e",
"md5": "9a040c84bfa0b5d4f6d73c3b4e79b141",
"sha256": "a5c53dfc32a07764d35966b99626d78ddbdf47251f568a5b2f2f8603ff7f498e"
},
"downloads": -1,
"filename": "kfst-4.0.0.tar.gz",
"has_sig": false,
"md5_digest": "9a040c84bfa0b5d4f6d73c3b4e79b141",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 11691,
"upload_time": "2023-10-23T13:21:49",
"upload_time_iso_8601": "2023-10-23T13:21:49.911875Z",
"url": "https://files.pythonhosted.org/packages/53/e6/e601542b9d266ae7a872bdd85d8a01711d10b7a9bf4be2c90d8479098a7e/kfst-4.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-23 13:21:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fergusq",
"github_project": "fst-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "kfst"
}