const articlesApostrophes = { 'de' : 'd\'', 'le' : 'l\'', 'la' : 'l\'' } export class Grammar { static apostrophe(article, word) { if (articlesApostrophes[article] && Grammar.startsWithVoyel(word)) { return articlesApostrophes[article] + word } return article + ' ' + word; } static startsWithVoyel(word) { return word.match(/^[aeiouy]/i) } static toLowerCaseNoAccent(words) { return words?.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") ?? words; } }