french-adjectives
v5.3.0
Published
Agreement of adjectives in French
Downloads
774
Readme
french-adjectives
A simple Node.js module that makes the agreement of French adjectives with gender and number. For instance beau becomes belles in feminine plural, and beaux in masculine plural.
It is based on rules and exceptions, not on an extensive list.
In French, the adjective can also vary depending on its position, if it is before or after the noun, and the kind of noun: un homme vieux / un vieil homme, un homme fou / un fol homme, un mol ectoplasme / un ectoplasme mou, un hamac vieux / un vieux hamac. This is also managed by this lib.
It exposes a single function, agree
, that takes up to 5 arguments:
- adjective (string, mandatory): the adjective not yet agreed
- gender (string, mandatory):
M
for masculine,F
for feminine - number (string, mandatory):
S
for singular,P
for plural - noun (string, optional): a string containing the noun; used only when the adjective is before the noun
- adjective is before noun (boolean, optional): set this last parameter to
true
if the noun is before the adjective; defaults tofalse
, as in French the adjective is most often after the noun - contraction exceptions (optional): contracted words are managed automatically, like in un vieil homme, but you can provide exceptions or override default; provide a map where the noun is the key and where the value is an object having a boolean
contract
property (seefrench-contractions
)
Installation
npm install french-adjectives
Usage
var adjectives = require('french-adjectives');
// "belles"
console.log( adjectives.agree('beau', 'F', 'P') );
// "vieil"
console.log( adjectives.agree('vieux', 'M', 'S', 'homme', true) );
See test.js
for examples.
dependencies and licences
french-contractions
: Checks how French words should be contracted (Apache 2.0)