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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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