A runtime environment for querying FSTs stored in the AT&T `.att` format.
Project description
fst-runtime
The fst_runtime
python package is written as a light-weight front-end for finite-state transducers compiled to AT&T's .att
format via programs like foma, hfst, etc. This runtime reads the FST into memory from the .att
file, and publishes two main query functions, down_generation
and up_analysis
, that walk the FST either down (wal+VERB+GER -> walking
) or up (walking -> wal+VERB+GER
), respectively.
There are also methods for bulk querying, down_generations
and up_analyses
.
Documentation for this project can be found at https://culturefoundryca.github.io/fst-runtime/.
Installation Instructions
This package is published on PyPI and can be installed via pip install fst_runtime
or poetry add fst_runtime
, etc.
Weighted FSTs
This runtime supports weighted FSTs, where the weights are defined under a semiring. Common semirings are provided via fst_runtime.semiring
.
Example Usage
from fst_runtime.fst import Fst
fst = Fst('/home/username/fsts/walk.att')
generations = fst.down_generation('wal', suffixes=[['+VERB'], ['+GER', '+INF']])
for generation in generations:
print(generation)
This example, based off of tests/data/fst4.att
, would then return the results of wal+VERB+GER
and wal+VERB+INF
which would be ['walking', 'walk']
. If you simply called fst.down_generation('wal')
, it would generate all possible wordforms of it in the FST.
Similarly with up:
analyses = fst.up_analysis('walking')
for analysis in analyses:
print(analysis)
In this case, we only get one result back, wal+VERB+GER
.
Acknowledgements
We would like to thank Dr. Miikka Silfverberg for his help in deciding what this application should look like, and for providing test FSTs for us to use to test the application.
We would also like to thank UBC's ELF-Lab for the use of the waabam
walk through their fully-fledged Ojibwe FST. You can find their repo here: https://github.com/ELF-Lab/OjibweMorph.
Also thank you to Sandra Radic for some early application code.
Development
For working on this project, please consult the wiki for the project's architecture and dev setup. PRs welcome.
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
Built Distribution
File details
Details for the file fst_runtime-0.1.0.tar.gz
.
File metadata
- Download URL: fst_runtime-0.1.0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3adba4775b6e5def8f05a572bd30d911295d37f80d72d145140755458abb0275 |
|
MD5 | fa478a45eec068ed5a45d9aa2d4e6d25 |
|
BLAKE2b-256 | 2a6d89203e30cc1058840e2d05bc732fa520e422fa9a0cace86d849bb2c2d3a2 |
File details
Details for the file fst_runtime-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: fst_runtime-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7484279c78ccb246537074f18c37b9265a3e6fb590501b702340042980c261b |
|
MD5 | 0af57247910ba939ce45c16eabebb43e |
|
BLAKE2b-256 | 46e4336393b9d8f889bd90c42172748a41df27773a7bd0240b325c196aa22db2 |