Skip to main content

python inflector for French language : control gender, tense and number

Project description

inflecteur

Open In Colab

inflecteur is a python inflector for french language based on the DELA dictionary

Installation :

$ pip install -U transformers 
$ pip install -U inflecteur

How to inflect ?

In [1]: from inflecteur import inflecteur
In [2]: inflecteur = inflecteur()
In [3]: inflecteur.load_dict()

Control tense :

In [4]: inflecteur.inflect_sentence("Elle boit un café et mange un croissant.", tense='Futur')
'Elle boira un café et mangera un croissant .'

In [5]: inflecteur.inflect_sentence("Elle boit un café et mange un croissant.", tense='Passé simple')
'Elle but un café et mangea un croissant .'

Control gender :

In [6]: inflecteur.inflect_sentence("Elle boit un café et mange un croissant.", gender='m')
'Il boit un café et mange un croissant .'

Control number :

In [7]: inflecteur.inflect_sentence("Elle boit un café et mange un croissant.", number='p')
'Elles boivent des cafés et mangent des croissants .'

Get word forms :

In [8]: inflecteur.get_word_form('pris')
lemma gram forme gender number tense person
0 prendre Verbe Kms M singular Passé composé
1 prendre Verbe Kmp M plural Passé composé
2 prendre Verbe J1s singular Passé simple Je
3 prendre Verbe J2s singular Passé simple Tu
4 prendre Verbe Kms M singular Passé composé
5 prendre Verbe J1s singular Passé simple Je
6 prendre Verbe J2s singular Passé simple Tu
7 pris Adjectif ms M singular
8 pris Adjectif mp M plural

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

inflecteur-0.1.4.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

inflecteur-0.1.4-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file inflecteur-0.1.4.tar.gz.

File metadata

  • Download URL: inflecteur-0.1.4.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for inflecteur-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3f9c3e16f79dc3ff5c4da1d95ed2f0b7d08fa4435719788d7370586a1582959c
MD5 0f5ff0d60325557e7d55c9473d6519db
BLAKE2b-256 d1b9840f8bbbff4c0ba87f2bc44e966fff7311e34e2dc9c892dfda306892831e

See more details on using hashes here.

File details

Details for the file inflecteur-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: inflecteur-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for inflecteur-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b6cfd259d19e766c2b3e5f65caa863458b08c51a821dea37cc97caf35f59b1e9
MD5 c3332d82fb549fe19cacdbba114ba310
BLAKE2b-256 0b629863e01952f311437fb6fc20381c5761686453e3c7048ebb8ca547ce11fc

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