Skip to main content

Rule-based Malayalam morphological synthesizer (noun inflection generation).

Project description

mlinflect

A rule-based Malayalam morphological synthesizer. It does forward morphological generation: given a root and grammatical features, it produces the inflected surface form (the counterpart to morphological analysis/segmentation).

from mlinflect import synthesize_noun, with_clitic, Case, Clitic, Number

synthesize_noun("മരം", Case.LOCATIVE).surface          # 'മരത്തിൽ'
synthesize_noun("മരം", Case.GENITIVE).surface          # 'മരത്തിന്റെ'
synthesize_noun("കുട്ടി", Case.GENITIVE).surface        # 'കുട്ടിയുടെ'
synthesize_noun("മരം", Case.NOMINATIVE, number=Number.PLURAL).surface  # 'മരങ്ങൾ'

with_clitic(synthesize_noun("കുട്ടി", Case.ACCUSATIVE), Clitic.UM).surface  # 'കുട്ടിയെയും'

Why this exists

Existing Malayalam morphology tools are either copyleft (Apertium, libindic = GPL/AGPL) or, in the case of the one permissive generator (mlmorph, MIT), built on a GPL FST runtime. There is no permissive, dependency-clean, rule-based Malayalam synthesizer. mlinflect aims to fill that gap with a small pure-Python rule engine and no copyleft dependencies.

Design

  • Declarative, provenance-tagged rules (mlinflect/rules.py): each rule cites the source it was drawn from and carries a verified flag that is True only when the form has been ratified by a native reviewer. Adding or correcting a paradigm is a data edit, not a code change.
  • Inspectable results: every synthesize_noun(...) returns a SynthResult with the surface form, the morphemes that compose it, the stem_class, the provenance key, and verified. Feature combinations that are not yet encoded raise rather than return a silently wrong form.
  • Akshara-correct joins: suffixes are represented matra-initial so concatenation produces correct conjuncts/vowel signs; the genitive uses the canonical nta form (NA + virama + RRA).

Status

Alpha. Eleven ending-conditioned noun classes across 11 cases, covering the major Malayalam noun shapes, with every encoded form native-ratified (verified=True); shapes outside the supported classes raise rather than guess. Five classes (am_neuter മരം, vowel_anuswara കലാം, i_vowel കുട്ടി/സ്ത്രീ, u_vowel പശു, ṭ_geminate വീട്) are complete in singular and plural; a_stem (അമ്മ) and the chillu classes (അവൻ, മകൾ, കാർ, കാൽ, തൂൺ) are singular-complete; their plurals are animacy-conditioned across the full paradigm (inanimate -കൾ/-ഉകൾ, human -മാർ/-ന്മാർ/-കാർ, animate -കൾ). Suppletive personal pronouns (ഞാൻ, നീ, അവർ, നാം, താൻ, ഇവൻ) are handled through an exception table rather than the rule engine. A derive_feminine helper builds a feminine lemma from a masculine base (എഴുത്തുകാരൻ → എഴുത്തുകാരി) before inflection. Includes differential object marking and a synthetic/colloquial register for the instrumental. See LIMITATIONS.md for the precise gaps. Clitics (-ഉം, -ഓ, -തന്നെ) attach via with_clitic. Postpositions, stylistic variants, and verbs are future work.

Install

pip install mlinflect
# from source:
pip install -e ".[dev]"

License

Apache-2.0. See LICENSE and NOTICE. Contributions are accepted under Apache-2.0 §5 (inbound = outbound); no separate CLA is required.

Linguistic sources are credited in REFERENCES.md.

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

mlinflect-0.0.5.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

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

mlinflect-0.0.5-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file mlinflect-0.0.5.tar.gz.

File metadata

  • Download URL: mlinflect-0.0.5.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for mlinflect-0.0.5.tar.gz
Algorithm Hash digest
SHA256 cabc912807e7060d5727f60e3ae89c7e569d82ee0067086de7ae87fad920088a
MD5 80e860ccdf02592ff8c9db952cdb5e73
BLAKE2b-256 4570f0708d8dd1b3b305c7ae215e4d0417b24703a1bba73cc86981ac9b303b90

See more details on using hashes here.

File details

Details for the file mlinflect-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: mlinflect-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for mlinflect-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f53cd5d4b4c1c3ee04e40dc55c3938dbe75b49b4d963061247a4bb9f2f8cd077
MD5 8b4b65b0fec7dd21df593bdf5b6726f5
BLAKE2b-256 2179c3f814c74b925a730cfec2ea6776bca5fc229c8ddefeada9e8877b207c53

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