french-words

Gender and plural of French words

Usage no npm install needed!

<script type="module">
  import frenchWords from 'https://cdn.skypack.dev/french-words';
</script>

README

french-words

Gender of French words: autoroute is feminine, déjeuner is masculine, etc. Use french-words-gender-lefff to add real linguistic resources.

Wrapper over rosaenlg-pluralize-fr to get plurals.

Installation

npm install french-words

Usage

const FrenchWordsLib = require('french-words');
const FrenchWordsLefff = require('french-words-gender-lefff/dist/words.json');

// M
console.log(FrenchWordsLib.getGender(null, FrenchWordsLefff, 'déjeuner'));

// F
console.log(FrenchWordsLib.getGender(null, FrenchWordsLefff, 'Console'));

// genoux
console.log(FrenchWordsLib.getPlural(null, 'genou'));

getGender, with the following parameters:

  • embedded word list: map where key is the word, and has a gender key: {'bague': { gender: 'F' }}
  • OR word list typically french-words-gender-lefff ({'bague':'F', 'blablabla':'F', ...})
  • word at its root form (will find autoroute but not autoroutes)

Case matters: DEA, DESS, DEUG etc.

getNumber, with the following parameters:

  • embedded word list: map where key is the word, and has a plural key: {'bague': { plural: 'bagues' }}; will use rosaenlg-pluralize-fr if not provided
  • word at its root form