Skip to main content

Python bindings for the foma finite-state technology suite

Project description

foma_bindings: Foma Python Bindings

These are python bindings for foma, a finite-state toolkit developed by Dr. Mans Hulden. These bindings are a subset of the functionality of foma, and are a modification of the file(s) in the python folder in the above foma repo. Those file(s) are edited, expanded, cleaned up, and packaged for distribution through pip; the changes made are listed below.

For additional functionality, please feel free to open up an issue on our github page describing what you'd like to see, how this is currently accomplished in foma, and the reasons why you would like to see this functionality. Feel free to fork this repo and implement the changes yourself as well, and make a pull request and we'll merge it in.

This package is maintained by CultureFoundry and created in conjunction with Dr. Miikka Silfverberg.

The Bindings

Here is an example of how to use these bindings:

from foma_bindings.fst import Fst

fst = Fst.load("/path/to/compiled/fst.fomabin")

for tagged_word in fst.apply_up("foxes", flags=Fst.TOKENIZE | Fst.PRINT_FLAGS)
    print(tagged_word)

Acknowledgements

Firstly, we would like to acknowledge the extensive work of Dr. Mans Hulden on the entire foma software suite; that software can be found here. These python bindings only exist because the software that Dr. Hulden wrote is so robust for language use.

Secondly, we would like to acknowledge the work of Dr. Miikka Silfverberg. Dr. Silfverberg has extensive experience and knowledge of foma, and has been instrumental not only in CultureFoundry's adoption of it in our language programs, but also in working with us to adapt and expand these python bindings to further foma's usability going forward. We hope he will be here to help us, and thereby the communities we are working with, for a long time to come!

Changelog

Changes from the original file as part of the Mans Hulden foma repo:

  • extensive readability edits have been made, including splitting classes into separate files, alphabetizing the C API mappings, and extensive renaming of function and variable names
  • get_alphabet and the aliased get_sigma functions have been added
  • the multi-tape FST class/section has been entirely commented out for now
  • additional printing parameters have been added, such as printing with flags included
  • the files have been made ready for distribution on pip
  • apache copyright notices have been added to all the relevant python files
  • add query function
  • add function to get the flag diacritics

0.1.11

  • fix bug where 0 was being given as 0+ in the query function for head tags.

0.1.10

  • add query_with_head_tags function to replace query function
  • add 2 month deprecation warning for query function

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

foma_bindings-0.1.11.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

foma_bindings-0.1.11-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file foma_bindings-0.1.11.tar.gz.

File metadata

  • Download URL: foma_bindings-0.1.11.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for foma_bindings-0.1.11.tar.gz
Algorithm Hash digest
SHA256 8126afe00b74045f4c4562146bfd013ccc659ccf0f5a5dcd6823b1b0831a904f
MD5 b59c47b7a5623a6acf48866a5585c1d5
BLAKE2b-256 197999133b131526a1af20f073f9d5806d114a9a536993021408f77fc1bb3982

See more details on using hashes here.

File details

Details for the file foma_bindings-0.1.11-py3-none-any.whl.

File metadata

File hashes

Hashes for foma_bindings-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 517b544e5bc28b5ad7529f9db202d2e4f4804015d90243d151fc1df48c257797
MD5 3be9db195fe1ba9494b37f3c8ccba4c3
BLAKE2b-256 c8fb3b9cec17c466441ef87bcf1e528d081a430df88d99a8f72765bd399be1a2

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