french-adjectives
TypeScript icon, indicating that this package has built-in type declarations

5.3.0 • Public • Published

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 to false, 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 (see french-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)

Dependents (1)

Package Sidebar

Install

npm i french-adjectives

Weekly Downloads

207

Version

5.3.0

License

Apache-2.0

Unpacked Size

40.1 kB

Total Files

6

Last publish

Collaborators

  • ludan.stoeckle