Skip to main content

A pip-installable library version of hfst-optimized-lookup from https://hfst.github.io/

Project description

hfst-optimized-lookup

PyPI version Documentation

A pip-installable library version of hfst-optimized-lookup, originally built for itwêwina.

Install

pip install hfst-optimized-lookup

This requires that the machine running pip have a working C++ compiler. If enough people ask for us to upload binary ‘wheels’ so that you don’t need a compiler at install time, we could start doing so.

Usage

Full API Documentation

Import the library:

>>> import hfst_optimized_lookup

Then load an FST!

>>> fst = hfst_optimized_lookup.TransducerFile('../crk-relaxed-analyzer-for-dictionary.hfstol')

Hint: Download crk-relaxed-analyzer-for-dictionary.hfstol by cloning https://github.com/UAlbertaALTLab/cree-intelligent-dictionary/tree/main/src/crkeng/resources/fst to follow along! The file itself is stored in Git LFS so is tricky to link to directly.

Do an ordinary lookup, to get a list of concatenated analyses for a wordform:

>>> fst.lookup('atim')
['atim+N+A+Sg', 'atimêw+V+TA+Imp+Imm+2Sg+3SgO']

Or get each parsed analysis from the wordform

>>> analysis = fst.lookup_lemma_with_affixes('atim')[0]
>>> analysis.lemma
'atim'
>>> analysis.suffixes
('+N', '+A', '+Sg')

You can also lookup the analyses with symbols separated:

>>> fst.lookup_symbols('atim')
[['a', 't', 'i', 'm', '+N', '+A', '+Sg'], ['a', 't', 'i', 'm', 'ê', 'w', '+V', '+TA', '+Imp', '+Imm', '+2Sg', '+3SgO']]

Releasing

Run ./release.py --help for details of the release process.

A typical release is:

  1. Make sure the “Unreleased” section of CHANGELOG.md is up-to-date

  2. Run the script:

    ./release.py --release-timezone=America/Edmonton --push --release
    

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

hfst-optimized-lookup-0.0.13.tar.gz (63.4 kB view details)

Uploaded Source

File details

Details for the file hfst-optimized-lookup-0.0.13.tar.gz.

File metadata

  • Download URL: hfst-optimized-lookup-0.0.13.tar.gz
  • Upload date:
  • Size: 63.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.5

File hashes

Hashes for hfst-optimized-lookup-0.0.13.tar.gz
Algorithm Hash digest
SHA256 a58b9199fa28c373ce59b1cea2e20d21de9043878bf3bc9d176de552f534b428
MD5 8ef0ec201a336d3f8cf8675e54f5c65c
BLAKE2b-256 a7e17d23601dc4520b667903939406106495b42332ad0f0429f2f7342a48480c

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