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

5.3.0 • Public • Published

french-contractions

Checks if a French word should be contracted:

  • le hérisson vs l'homme
  • le yaourt vs l'ylang-ylang
  • l'iode vs le iota

Same rules can also be used to manage cet/cet:

  • ce hérisson vs cet homme
  • cet arbre vs ce yaourt

And for adjectives:

  • vieux hérisson vs vieil homme
  • vieil arbre vs vieux yaourt

Also uses and provides a list of words with "h aspiré", which you can use with or without the helpers.

Installation

npm install french-contractions

Usage

One function contracts that take 2 arguments:

  • the word (noun or adjective)
  • a map of custom exceptions (optional): the word is the key, the value must be an object having a contracts property with a boolean value
const lib = require('french-contractions');

// hérisson contracts? false
// homme contracts? true
// yaourt contracts? false
// iode contracts? true
['hérisson', 'homme', 'yaourt', 'iode'].forEach((word) => {
  console.log(`${word} contracts? ${lib.contracts(word)}`);
});

dependencies and licences

List of h words based on https://en.wikipedia.org/wiki/Aspirated_h. The derived list in hmuet.ts remains under CC BY-SA 3.0.

Package Sidebar

Install

npm i french-contractions

Weekly Downloads

183

Version

5.3.0

License

Apache-2.0

Unpacked Size

124 kB

Total Files

14

Last publish

Collaborators

  • ludan.stoeckle