Skip to main content

A pure Python implementation of HFST for using HFST optimized lookup transducers (with or without weights)

Project description

Pyhfst

DOI

Pyhfst is a pure Python implementation of HFST. The library makes it possible to use HFST optimized lookup FSTs without any C dependencies. Both weighted and unweighted FSTs are supported.

The library will run on all operting systems that support Python 3.

Installation

pip install pyhfst

Pyhfst can run way faster if you have Cython installed. After installing Cython, you must reinstall Pyhfst

pip install cython
pip install --upgrade --force-reinstall pyhfst --no-cache-dir

Usage

import pyhfst

input_stream = pyhfst.HfstInputStream("./analyser")
tr = input_stream.read()
print(tr.lookup("voi"))

>> [['voida+V+Act+Ind+Prs+Sg3', 0.0], ['voida+V+Act+Ind+Prs+ConNeg', 0.0], ['voida+V+Act+Ind+Prt+Sg3', 0.0], ['voida+V+Act+Imprt+Prs+ConNeg+Sg2', 0.0], ['voida+V+Act+Imprt+Sg2', 0.0], ['voi+N+Sg+Nom', 0.0], ['voi+Pcle', 0.0], ['voi+Interj', 0.0]]

Citation

Please cite the library as follows:

Alnajjar, K., & Hämäläinen, M. (2023, December). PYHFST: A Pure Python Implementation of HFST. In Lightning Proceedings of NLP4DH and IWCLUL 2023 (pp. 32-35).

@article{pyhfst_2023, 
    title={PyHFST: A Pure Python Implementation of HFST},
    author={Alnajjar, Khalid and H{\"a}m{\"a}l{\"a}inen, Mika},
    booktitle={Lightning Proceedings of NLP4DH and IWCLUL 2023},
    pages={32--35},
    year={2023} 
}

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

pyhfst-1.4.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyhfst-1.4.0-py2.py3-none-any.whl (28.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyhfst-1.4.0.tar.gz.

File metadata

  • Download URL: pyhfst-1.4.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pyhfst-1.4.0.tar.gz
Algorithm Hash digest
SHA256 848ec5a22528166cdaa6f0df1f4e9e38c765c64b3ec2eaca9874aed57fcfda55
MD5 edd8f3f41c8bff6e0cedf40662944084
BLAKE2b-256 6ed440c2965130aa8efac56e19d0e4a1923d190daa0ee8f681b45158c214f4f0

See more details on using hashes here.

File details

Details for the file pyhfst-1.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pyhfst-1.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pyhfst-1.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dd3fea517b8b8abf424992f4b301ec21ed9e7ce733f2ee353bbdda2cad9773ab
MD5 fd7a8bbb3b3f00f3acbca76c359496a1
BLAKE2b-256 d88c2156c6aab5bfd7d024b8f44bbf83c7822760921e9a262fdfd8ee7b63f120

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page