Skip to main content

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

fst_runtime-0.1.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

fst_runtime-0.1.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file fst_runtime-0.1.1.tar.gz.

File metadata

  • Download URL: fst_runtime-0.1.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for fst_runtime-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ca40a4111f93bbd8bc8f82f4562c358eb37206bf447f19bedfd139e02efc5b53
MD5 442929b130a8b6099616fc86d8abc598
BLAKE2b-256 8553e7f250ac3bbe9bc9467a474e51178b0f603adcb06422d83057845f68a0f9

See more details on using hashes here.

File details

Details for the file fst_runtime-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fst_runtime-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for fst_runtime-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f162cbb9b4c1c2637edd5e2109f18f221c280ee2f4f38f34bf28e8bb5458cbbd
MD5 f1d30992093d30588ff7246f9a7e2fec
BLAKE2b-256 7f01e1669e5b74ed22ae5bfc14fc7b2db8f237e7b9268e27a08aeb76c54bc4a3

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