<!--
Copyright 2019 Ludan Stoecklé
SPDX-License-Identifier: CC-BY-4.0
-->
# french-verbs

## Features

Agreement of French verbs, based on a list of verbs.

Use `french-verbs-lefff` as a compatible list of verbs.

Contractions are managed: _elle s'est marrée_, _il se gausse_, _elle s'hydrate_, _ils se haïssent_.

Contains a short static list of verbs that always take "être" auxiliary at past tenses (_Passé Composé_ and _Plus Que Parfait_).


## Installation 
```sh
npm install french-verbs
```

## Usage

```javascript
const FrenchVerbs = require('french-verbs');
const Lefff = require('french-verbs-lefff/dist/conjugations.json');

// elle est allée
console.log(
  'elle ' + FrenchVerbs.getConjugation(Lefff, 'aller', 'PASSE_COMPOSE', 2, { aux: 'ETRE', agreeGender: 'F' }),
);

// je finis
console.log('je ' + FrenchVerbs.getConjugation(Lefff, 'finir', 'PRESENT', 0));
```

For *conjugations*, one single function `getConjugation`, with multiple parameters:

* `verbsList`: list of verbs; use `french-verbs-lefff` for instance (or anything with the same format)
* `verb`: string, mandatory. Infinitive form of the verb.
* `tense`: string, mandatory. Choose beetwen `PRESENT`, `FUTUR`, `IMPARFAIT`, `PASSE_SIMPLE`, `PASSE_COMPOSE`, `PLUS_QUE_PARFAIT`, `PASSE_ANTERIEUR`, `FUTUR_ANTERIEUR`, `CONDITIONNEL_PRESENT`, `CONDITIONNEL_PASSE_1`, `CONDITIONNEL_PASSE_2`, `IMPERATIF_PRESENT`, `IMPERATIF_PASSE`, `SUBJONCTIF_PRESENT`, `SUBJONCTIF_IMPARFAIT`, `SUBJONCTIF_PASSE`, `SUBJONCTIF_PLUS_QUE_PARFAIT`, `INFINITIF`, `INFINITIF_PASSE`, `PARTICIPE_PRESENT`, `PARTICIPE_PASSE`, `PARTICIPE_PASSE_COMPOSE`.
* `person`: number, mandatory. Indicates the person: 0=je, 1=tu, 2=il/elle, 3=nous, 4=vous, 5=ils/elles.
* when tense is composed or passive voice, a structure with the following properties:
  * `aux`: auxiliary, `AVOIR` or `ETRE`. If the auxiliary is not set, these rules will apply:
    * pronominal verbs always use `ETRE`
    * there is a short list of verbs that always take `ETRE`
    * transitive verbs rather take `AVOIR`
  * `agreeGender`: `M` or `F` if you want to agree the past participle
  * `agreeNumber`: `S` or `P` if you want to agree the past participle
* `pronominal`: boolean. Put `true` to trigger pronominal form. You can alternatively indicate the pronominal form in the verb directly: `s'écrier`, `se rendre`, etc.
* `negativeAdverb`: you can add a negative adverb (`pas`, `plus`, `jamais`, etc.); this is useful for `PASSE_COMPOSE` and `PLUS_QUE_PARFAIT`, as the negative adverb will be put between the auxiliary and the past participle (e.g. `a pas donné`).
* `modifierAdverb`: you can add a modifier adverb (`vraiment`, `probablement`, `beaucoup`, etc.); this is useful for inserting an adverb before the direct nounPhrase object. The modifier adverb will be put between the auxiliary and the past participle (e.g. `a beaucoup donné`). In case of a negative adverb, it will be put just after the negative adverb. (e.g. `a pas vraiment donné`). 

`alwaysAuxEtre` returns `true` if the verb (passed as an infitive) always conjugates with "être" auxiliary.

`isTransitive` returns `true` if the verb (passed as an infitive) is transitive.

`getAux` tries to guess which auxiliary should be used and returns `AVOIR` or `ETRE`. It uses some rules and lists (e.g. some verbs always take `ETRE`, transitive verbs always use `AVOIR`).

The agreement is not done automatically even when `aux` is `ETRE`, as the subject gender is not known.

