Commit 6b8c0c93 authored by Ludan Stoecklé's avatar Ludan Stoecklé

1.15.3

parent 6f57f840
......@@ -20,7 +20,7 @@ stages:
# variables etc.
variables:
ROSAENLG_VERSION: 1.15.2
ROSAENLG_VERSION: 1.15.3
DOCKER_REGISTRY: registry.gitlab.com/rosaenlg-projects/rosaenlg
DOCKER_CLI_ROOT: ${DOCKER_REGISTRY}/cli
DOCKER_SERVER_ROOT: ${DOCKER_REGISTRY}/server
......
{
"name": "browser-ide-demo-2",
"version": "0.2.2",
"version": "0.2.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
......@@ -41,8 +41,8 @@
"gulp-awspublish": "^4.0.1",
"gulp-rename": "^2.0.0",
"merge-stream": "^2.0.0",
"rosaenlg": "1.15.2",
"rosaenlg-packager": "0.2.2",
"rosaenlg": "1.15.3",
"rosaenlg-packager": "0.2.3",
"s3": "^4.4.0",
"vue-simple-alert": "^1.1.1",
"vue-template-compiler": "^2.6.11"
......
{
"name": "english-a-an-list",
"version": "0.7.2",
"version": "0.7.3",
"description": "English words and adjectives that are preceded by the indefinite article 'an', based on WordNet",
"main": "dist/aan.json",
"scripts": {
......
{
"name": "english-a-an",
"version": "0.7.2",
"version": "0.7.3",
"description": "English a/an indefinite articles, based on WordNet",
"main": "dist/index.js",
"scripts": {
......@@ -44,7 +44,7 @@
}
},
"devDependencies": {
"english-a-an-list": "0.7.2"
"english-a-an-list": "0.7.3"
},
"keywords": [
"English",
......
{
"name": "english-determiners",
"version": "2.15.2",
"version": "2.15.3",
"description": "English determiners",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......@@ -43,9 +43,6 @@
]
}
},
"dependencies": {
"debug": "^4.1.1"
},
"keywords": [
"english",
"determiners"
......
{
"name": "english-ordinals",
"version": "0.1.2",
"version": "0.1.3",
"description": "Ordinal numbers in English: 1 => first etc.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......
{
"name": "english-plurals-list",
"version": "0.7.2",
"version": "0.7.3",
"description": "English irregular plurals list, based on WordNet",
"main": "dist/plurals.json",
"scripts": {
......
{
"name": "english-plurals",
"version": "0.7.2",
"version": "0.7.3",
"description": "English plural of words",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......@@ -45,7 +45,7 @@
}
},
"devDependencies": {
"english-plurals-list": "0.7.2"
"english-plurals-list": "0.7.3"
},
"keywords": [
"words",
......
{
"name": "english-verbs-gerunds",
"version": "0.7.2",
"version": "0.7.3",
"description": "English irregular gerunds list (-ing), based on WordNet",
"main": "dist/gerunds.json",
"scripts": {
......
{
"name": "english-verbs-helper",
"version": "0.7.2",
"version": "0.7.3",
"description": "English verbs conjugation",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......@@ -45,8 +45,8 @@
}
},
"devDependencies": {
"english-verbs-gerunds": "0.7.2",
"english-verbs-irregular": "0.7.2"
"english-verbs-gerunds": "0.7.3",
"english-verbs-irregular": "0.7.3"
},
"keywords": [
"verbs",
......
{
"name": "english-verbs-irregular",
"version": "0.7.2",
"version": "0.7.3",
"description": "English irregular verbs list (JSON)",
"main": "dist/verbs.json",
"scripts": {
......
import { isHMuet } from 'french-h-muet-aspire';
import { contracts } from 'french-contractions';
import { agree as agreeFct, getChangeant, GendersMF, Numbers } from 'french-adjectives';
export interface AdjectiveInfo {
......@@ -64,12 +64,7 @@ export function agreeAdjective(
const agreedAdj = adjectivesInfo[adjective][key];
if (isBeforeNoun && number === 'S' && adjectivesInfo[adjective][agreedAdj] != null) {
const nounStartsVowel: boolean =
'aeiouyàáâãäåèéêëìíîïòóôõöøùúûüÿAEIOUYÀÁÂÃÄÅÈÉÊËÌÍÎÏÒÓÔÕÖØÙÚÛÜŸ'.indexOf(noun.charAt(0)) > -1;
const nounIsHMuet: boolean = noun.charAt(0).toLowerCase() === 'h' && isHMuet(noun);
if (nounStartsVowel || nounIsHMuet) {
// console.log(`${adj} followed by ${noun}, we change it`);
if (contracts(noun)) {
return adjectivesInfo[adjective][agreedAdj];
}
}
......
{
"name": "french-adjectives-wrapper",
"version": "0.1.2",
"version": "0.1.3",
"description": "Agreement of adjectives in French - Wrapper",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......@@ -45,9 +45,8 @@
}
},
"dependencies": {
"debug": "^4.1.1",
"french-adjectives": "2.15.2",
"french-h-muet-aspire": "2.15.2"
"french-adjectives": "2.15.3",
"french-contractions": "2.15.3"
},
"keywords": [
"french",
......
......@@ -45,6 +45,9 @@ describe('french-adjectives-wrapper', function () {
it(`vieil alsacien`, function () {
assert.equal(lib.agreeAdjective({ vieux: vieux }, 'vieux', 'M', 'S', 'alsacien', true), 'vieil');
});
it(`vieux yaourt`, function () {
assert.equal(lib.agreeAdjective({ vieux: vieux }, 'vieux', 'M', 'S', 'yaourt', true), 'vieux');
});
it(`vieux alsaciens`, function () {
assert.equal(lib.agreeAdjective({ vieux: vieux }, 'vieux', 'M', 'P', 'alsacien', true), 'vieux');
});
......
......@@ -38,4 +38,4 @@ See `test.js` for examples.
## dependencies and licences
* `french-h-muet-aspire`: List of "h muet" and "h aspiré" words under MIT
* `french-contractions`: Checks how French words should be contracted (MIT)
import { isHMuet } from 'french-h-muet-aspire';
// import * as Debug from 'debug';
// const debug = Debug('french-adjectives');
import { contracts } from 'french-contractions';
/*
accord des adjectifs
......@@ -641,12 +638,8 @@ export function getChangeant(agreedAdj: string): string {
function getBeforeNoun(agreedAdj: string, noun: string): string {
if (adjChangeants[agreedAdj]) {
const nounStartsVowel: boolean =
'aeiouyàáâãäåèéêëìíîïòóôõöøùúûüÿAEIOUYÀÁÂÃÄÅÈÉÊËÌÍÎÏÒÓÔÕÖØÙÚÛÜŸ'.indexOf(noun.charAt(0)) > -1;
const nounIsHMuet: boolean = noun.charAt(0).toLowerCase() === 'h' && isHMuet(noun);
if (nounStartsVowel || nounIsHMuet) {
// debug(`${adj} followed by ${noun}, we change it`);
if (contracts(noun)) {
// console.log(`${adj} followed by ${noun}, we change it`);
return adjChangeants[agreedAdj];
}
}
......
{
"name": "french-adjectives",
"version": "2.15.2",
"version": "2.15.3",
"description": "Agreement of adjectives in French",
"main": "dist/index.js",
"types": "dist/index.d.ts",
......@@ -45,8 +45,7 @@
}
},
"dependencies": {
"debug": "^4.1.1",
"french-h-muet-aspire": "2.15.2"
"french-contractions": "2.15.3"
},
"keywords": [
"french",
......
......@@ -55,6 +55,8 @@ const testCasesWithNoun = [
['vieux', 'M', 'S', 'vieux', 'tricheur', true],
['vieux', 'M', 'S', 'vieil', 'alsacien', true],
['vieux', 'M', 'P', 'vieux', 'alsaciens', true],
['vieux', 'M', 'S', 'vieux', 'yaourt', true],
['vieux', 'M', 'S', 'vieil', 'ylang-ylang', true],
];
describe('french-adjectives', function () {
......
# 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
```sh
npm install french-contractions
```
## Usage
```javascript
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](https://creativecommons.org/licenses/by-sa/3.0/).
const lib = require('./dist/index.js');
// 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)}`);
});
export * from './hmuet';
export * from './vowel';
import { isH, isHAspire } from './hmuet';
import { beginsWithVowel, isContractedVowelWord } from './vowel';
export function contracts(word: string): boolean {
if (beginsWithVowel(word) && isContractedVowelWord(word)) {
return true;
} else if (isH(word) && !isHAspire(word)) {
return true;
}
return false;
}
// ne sont pas contractés
const exceptions = [
'iaido',
'iatron',
'iench',
'iourte',
'iota',
'iule',
'oolong', // cf. wikipedia
'ouatine',
'ouistiti',
'ouolof',
'uigur',
'onze',
'onzième',
'oui',
'uhlan',
];
const vowels = 'aeiouyàáâãäåèéêëìíîïòóôõöøùúûüÿAEIOUYÀÁÂÃÄÅÈÉÊËÌÍÎÏÒÓÔÕÖØÙÚÛÜŸ';
const beginsWithVowelRE = new RegExp(`^[${vowels}]`);
export function beginsWithVowel(word: string): boolean {
return beginsWithVowelRE.test(word);
}
export function isContractedVowelWord(word: string): boolean {
if (!beginsWithVowel(word)) {
return false;
}
const first = word.charAt(0).toLowerCase();
if ((first === 'i' || first === 'o' || first === 'u') && exceptions.indexOf(word) > -1) {
return false;
}
if (first === 'y') {
const second = word.charAt(1).toLowerCase();
if (second && vowels.indexOf(second) > -1) {
return false;
}
}
return true;
}
/*
a
aa NA
ae
l'aéroplane
toujours l'
ai
l'
ao
au
ay
==> a : osef de ce qui suit, toujours l'
e
ea ok
ee ok
ei ok
eo ok
eu ok
ey ok
===> e : toujours l'
i
a
le iaido
la iatron
sinon l'
e
le iench
i
o
l'iode
l'ionosphère
la iourte
le iota
u
le iule
y
===> quelques exceptions
o
a
e
i
o
le oolong cf. wikipedia
u
la ouatine
le ouistiti
le ouolof
y
u
a
e
i
le uigur
u
y
y
a
le : yac
TOUS LES YA
le yaourt
le yak
le yacht
le yassa
e
TOUS
la yeuze
yéti <= bon cas é
i
TOUS
Yiddish
yin
o
TOUS
le yoghourt
le yogi
yoyo
u
TOUS
yuan
yuzu
l'ylang-ylang
https://www.linternaute.fr/dictionnaire/fr/abecedaire/ya/1/
*/
{
"name": "french-h-muet-aspire",
"version": "2.15.2",
"description": "List of French words that are 'aspiré' (vs. 'muet')",
"name": "french-contractions",
"version": "2.15.3",
"description": "French contractions: le hérisson, l'homme, ce yaourt, cet arbre",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
......@@ -45,14 +45,12 @@
}
},
"keywords": [
"french",
"French",
"contractions",
"h",
"muet",
"aspiré"
],
"author": "Ludan Stoecklé <[email protected]>",
"license": "MIT",
"dependencies": {
"debug": "^4.1.1"
}
"license": "MIT"
}
sonar.projectName=french-h-muet-aspire
sonar.projectName=french-contractions
sonar.sources=lib
sonar.tests=test
sonar.javascript.lcov.reportPaths=coverage/lcov.info
const lib = require('../dist/index.js');
const assert = require('assert');
const testCases = {
blabla: false,
camembert: false,
// h
hérisson: false,
Hérisson: false,
homme: true,
Homme: true,
// vowels
à: true, // d'à côté
aéroplane: true,
eau: true,
Einstein: true,
ouistiti: false,
oukaze: true,
iode: true,
iota: false,
iench: false,
//y
yéti: false,
Yiddish: false,
yaourt: false,
'ylang-ylang': true,
y: true, // d'y aller
// new ones
onze: false,
onzième: false,
oui: false,
uhlan: false,
yatagan: false,
};
describe('french-contractions', function () {
describe('#contracts()', function () {
const keys = Object.keys(testCases);
for (let i = 0; i < keys.length; i++) {
const word = keys[i];
const expected = testCases[word];
it(`${word} => contracted? ${expected}`, function () {
assert.equal(lib.contracts(word), expected);
});
}
});
describe('#isContractedVowelWord()', function () {
it('not a vowel', function () {
assert(!lib.isContractedVowelWord('toto'));
});
});
describe('#isHAspire()', function () {
it('hâbleuse aspiré', function () {