Skip to main content

tatar-morph

tatar-morph is a Python library for morphological analysis, lemmatization, and word-form generation for the Tatar language. It uses the hfst package to work with HFST transducers.

The project is at an early stage of development. The public API may change between releases.

Features

  • Parse a word into its lemma and morphological features.
  • Return all possible lemmas for a word.
  • Generate word forms from a lemma and a set of features.
  • Represent parts of speech, cases, numbers, tenses, and other grammatical categories with typed values.
  • Work with existing HFST analyzer and generator transducers.

Requirements

  • Python 3.12 or newer.
  • An HFST transducer for analyzing Tatar words.
  • An HFST transducer for generating Tatar word forms.

The transducers are not bundled with the package and must be obtained separately.

Installation

python -m pip install tatar-morph

Quick start

You can pass the transducer paths directly:

from pathlib import Path

from tatar_morph import build_default_hfst_morph

morph = build_default_hfst_morph(
    automorf_path=Path("/path/to/tat.automorf.hfst"),
    autogen_path=Path("/path/to/tat.autogen.hfst"),
)

for analysis in morph.parse("өй"):
    print(analysis.lemma)
    print(analysis.features.all())
    print(analysis.raw_tags)

print(morph.lemmatize("өйләр"))

Alternatively, set the TATAR_AUTOMORF_PATH and TATAR_AUTOGEN_PATH environment variables:

export TATAR_AUTOMORF_PATH=/path/to/tat.automorf.hfst
export TATAR_AUTOGEN_PATH=/path/to/tat.autogen.hfst
from tatar_morph import build_default_hfst_morph

morph = build_default_hfst_morph()
analyses = list(morph.parse("бар"))

Features returned by the analyzer can be used to generate word forms:

analysis = next(morph.parse("өй"))
forms = list(morph.generate(analysis.lemma, analysis.features.all()))

for form in forms:
    print(form.word, form.weight)

Development

Install the dependencies and run the checks:

uv sync --dev
uv run pytest
uv run ruff check .
uv run mypy tatar_morph

Releasing a new version

The package version is derived automatically from the Git tag by setuptools-scm. Create a tag prefixed with v and push it to GitHub:

git tag v0.1.0
git push origin v0.1.0

GitHub Actions derives the version from the tag, verifies the version in the built wheel, publishes the package to PyPI, and creates a GitHub Release. Before the first release, configure a Trusted Publisher for the tatar-morph project on PyPI with the EnterNick/tatar-morph repository, the release.yml workflow, and the pypi environment.

License

This project is distributed under the GNU General Public License version 3. See LICENSE for the full license text.

Metadata

Release files for tatar-morph 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tatar-morph 0.1.0
File Size Uploaded
tatar_morph-0.1.0.tar.gz 28.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tatar-morph 0.1.0
File Interpreter ABI Platform
tatar_morph-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 59.5 kB

Release files / tatar_morph-0.1.0.tar.gz

Download URL tatar_morph-0.1.0.tar.gz
Size 28.9 kB
Tags Source
SHA-256 checksum
How to use checksums
694fb7e06e5559953b6976c47a8ac5262c61dab2799539fc59ac8dd35af4cf5d
BLAKE2b-256 checksum
How to use checksums
35f8190740a7a5b5da179c27646b8438021f2e19d1e325f2975bbe42afefa8d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release files / tatar_morph-0.1.0-py3-none-any.whl

Download URL tatar_morph-0.1.0-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf718a0d03279d698867816df69851186540f11d344b7f1983791036ebb8a839
BLAKE2b-256 checksum
How to use checksums
257dafbcea0da1ba03b0656b4d9bd6a8d48738b23eb69552fe35cb33f14a93f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page