Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
Lau Skeeter committed Mar 18, 2018
1 parent 433f20f commit 5621150
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/makeSpanish.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const makeSpanish = (words) => {

/*ph*/
word = word.replace(/ph/g,`f`);
word = word.replace(/th/g,`t`);

/*normalize*/
word = word.replace(/[e,o,a]$/g,`${genderCharacter}`);
Expand All @@ -45,16 +46,22 @@ const makeSpanish = (words) => {
/*rae.es told me to do this*/
word = word.replace(/ck/g, 'qu');
word = word.replace(/wh/g, 'gu');
word = word.replace(/ght/g, 'z');
word = word.replace(/ct/g, 'cc');
word = word.replace(/(?!^)y([aeiou])/g, 'i$1');
word = word.replace(/^y([aeiou])/g, 'j$1');

/*avoid 3+ vowels*/
word = word.replace(/([aeio][aeiou])([aeiou])([b-df-hj-np-tv-xz])/g,'$1$3$2');
word = word.replace(/([aeiou])w([aeiou])/g,'$1gu$2');
word = word.replace(/([aeiou])v([aeiou])/g,'$1b$2');

/*remove all doubles*/
word = word.replace(/ou/g, 'o');
word = word.replace(/([a-z])\1/g, '$1');

/*avoid 3+ vowels*/
word = word.replace(/([aeiou][aeiou])([aeiou])([b-df-hj-np-tv-xz])/g,'$1$3$2');


/*alt+n + n*/
word = word.replace(/(ny|ni)/g,`ñ`);
return word;
Expand Down

0 comments on commit 5621150

Please sign in to comment.