Skip to main content

French lemma prediction and derivative form generation with ONNX Runtime.

Project description

pyfrspell

English | 中文 | Francais

pyfrspell is a Python package for French lemma prediction and derivative form generation. It supports:

  • conjugation to lemma prediction
  • noun form generation
  • adjective form generation
  • verb form generation

The package runs with ONNX Runtime and quantized INT8 models for high speed and small model footprint.

Install

pip install pyfrspell

Integrate Into Your Project

from pyfrspell import FrSpell

predictor = FrSpell()

lemma = predictor.lemma("mangeons")
noun = predictor.noun_derive("chat", "THD_PLF")
adje = predictor.adje_derive("beau", "THD_F")
verb = predictor.verb_derive("manger", "FST_PL", "INDI", "PRES")

print(lemma)
print(noun)
print(adje)
print(verb)

Sample runtime output:

{'input': 'mangeons', 'lemma': 'manger', 'wordType': 'VERB', 'confidence': 0.9965, 'timeMs': 3.89}
{'lemma': 'chat', 'wordType': 'NOUN', 'person': 'THD_PLF', 'mode': 'ALL', 'tense': 'ALL', 'output': 'chattes', 'confidence': 0.9997, 'timeMs': 5.06}
{'lemma': 'beau', 'wordType': 'ADJE', 'person': 'THD_F', 'mode': 'ALL', 'tense': 'ALL', 'output': 'belle', 'confidence': 0.9999, 'timeMs': 3.08}
{'lemma': 'manger', 'wordType': 'VERB', 'person': 'FST_PL', 'mode': 'INDI', 'tense': 'PRES', 'output': 'mangeons', 'confidence': 0.9999, 'timeMs': 4.79}

Prediction Parameters

Lemma prediction:

  • API: predictor.lemma(input_word)
  • input_word: string, inflected or conjugated word form, for example mangeons

Derive prediction:

  • Noun API: predictor.noun_derive(lemma, person)
  • Adjective API: predictor.adje_derive(lemma, person)
  • Verb API: predictor.verb_derive(lemma, person, mode, tense)
  • Generic API: predictor.derive(lemma, word_type, person, mode, tense)

Allowed word_type values:

  • NOUN (noun)
  • ADJE (adjective)
  • VERB (verb)

Allowed person values:

  • FST (1st person singular)
  • SND (2nd person singular)
  • THD_M (3rd person masculine singular)
  • THD_F (3rd person feminine singular)
  • FST_PL (1st person plural)
  • SND_PL (2nd person plural)
  • THD_PLM (3rd person masculine plural)
  • THD_PLF (3rd person feminine plural)

Allowed mode values:

  • INDI (indicative)
  • SUBJ (subjunctive)
  • COND (conditional)
  • PART (participle)
  • IMPE (imperative)
  • INFI (infinitive)

Allowed tense values in current implementation:

  • PRES (present)
  • IMPA (imperfect)
  • FUTU (future)
  • PASS (past)

Note:

  • The original grammar definition includes more tense names, but this package currently supports only PRES, IMPA, FUTU, PASS.
  • For noun and adjective derive calls, mode and tense are not required in user input.

Run Test

python smoke_test.py --verbose

This runs a local smoke test to validate import, model loading, and core APIs.

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

pyfrspell-0.1.1.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

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

pyfrspell-0.1.1-py3-none-any.whl (2.8 MB view details)

Uploaded Python 3

File details

Details for the file pyfrspell-0.1.1.tar.gz.

File metadata

  • Download URL: pyfrspell-0.1.1.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pyfrspell-0.1.1.tar.gz
Algorithm Hash digest
SHA256 50e0ebb9a093160403f07ed001a45c472978ff68adca6df35db4a322d52af36d
MD5 b4bbd52ed375c2c46ad7d5000f6a3a71
BLAKE2b-256 a68f4215f73cb0f9635b94d1980d950438577f25c1fb779fa373f38da5324982

See more details on using hashes here.

File details

Details for the file pyfrspell-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyfrspell-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pyfrspell-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7dae6eb2fdb534bf6afe9500c1923dfc0491c3df511f922023a19ab702a278c8
MD5 c3dfee4a43276f7cfe5394394b7aedc2
BLAKE2b-256 dade156f40f6d87047ea8017cdcb29c61d0117490ba9dca8d549b136f183e47f

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