UNPKG

phonemize

Version:

Fast phonemizer with rule-based G2P prediction. Pure JavaScript implementation.

1 lines 65.9 kB
"use strict";Object.defineProperty(exports,`__esModule`,{value:!0});var utils=require(`./utils-Dq_eIfdp.cjs`),lookupTable=require(`./en/exceptions.json`),homographs=require(`./en/homographs.json`),compoundParts=require(`./en/compound-parts.json`);function _interopNamespaceDefault(t){var p=Object.create(null);return t&&Object.keys(t).forEach(function(m){if(m!==`default`){var h=Object.getOwnPropertyDescriptor(t,m);Object.defineProperty(p,m,h.get?h:{enumerable:!0,get:function(){return t[m]}})}}),p.default=t,Object.freeze(p)}var lookupTable__namespace=_interopNamespaceDefault(lookupTable),homographs__namespace=_interopNamespaceDefault(homographs),compoundParts__namespace=_interopNamespaceDefault(compoundParts),ONES={0:`zero`,1:`one`,2:`two`,3:`three`,4:`four`,5:`five`,6:`six`,7:`seven`,8:`eight`,9:`nine`,10:`ten`,11:`eleven`,12:`twelve`,13:`thirteen`,14:`fourteen`,15:`fifteen`,16:`sixteen`,17:`seventeen`,18:`eighteen`,19:`nineteen`},TENS={20:`twenty`,30:`thirty`,40:`forty`,50:`fifty`,60:`sixty`,70:`seventy`,80:`eighty`,90:`ninety`},SCALES={100:`hundred`,1e3:`thousand`,1e6:`million`,1e9:`billion`,0xe8d4a51000:`trillion`};function numberToWords(t){if(t===0)return`zero`;if(t<0)return`negative `+numberToWords(-t);if(t<20)return ONES[t]||``;if(t<100){var p=Math.floor(t/10)*10,m=t%10;return TENS[p]+(m>0?` `+ONES[m]:``)}if(t<1e3){var h=Math.floor(t/100),g=t%100;return ONES[h]+` hundred`+(g>0?` `+numberToWords(g):``)}for(var _=[0xe8d4a51000,1e9,1e6,1e3],v=0,y=_;v<y.length;v++){var w=y[v];if(t>=w){var T=Math.floor(t/w),g=t%w;return numberToWords(T)+` `+SCALES[w]+(g>0?` `+numberToWords(g):``)}}return t.toString()}function ordinalToWords(t){var p=numberToWords(t);if(t%100>=11&&t%100<=13)return p+`th`;switch(t%10){case 1:return p.replace(/one$/,`first`);case 2:return p.replace(/two$/,`second`);case 3:return p.replace(/three$/,`third`);case 5:return p.replace(/five$/,`fifth`);case 8:return p.replace(/eight$/,`eighth`);case 9:return p.replace(/nine$/,`ninth`);default:return p+`th`}}var ABBREVIATIONS={mr:`mister`,mrs:`missus`,ms:`miss`,dr:`doctor`,prof:`professor`,sr:`senior`,jr:`junior`,am:`a m`,pm:`p m`,etc:`etcetera`,vs:`versus`,inc:`incorporated`,corp:`corporation`,ltd:`limited`,co:`company`,st:`street`,ave:`avenue`,blvd:`boulevard`,rd:`road`,apt:`apartment`,dept:`department`,gov:`government`,org:`organization`,edu:`education`,com:`commercial`,net:`network`,info:`information`};function expandNumbers(t){return t=t.replace(/\$(\d+(?:,\d{3})*(?:\.\d{2})?)/g,function(t,p){var m=parseFloat(p.replace(/,/g,``)),h=Math.floor(m),g=Math.round((m-h)*100),_=``;return h>0&&(_+=numberToWords(h)+(h===1?` dollar`:` dollars`)),g>0&&(h>0&&(_+=` and `),_+=numberToWords(g)+(g===1?` cent`:` cents`)),_||`zero dollars`}),t=t.replace(/\b(1[89]\d{2}|20\d{2})\b/g,function(t){var p=parseInt(t);if(p>=2e3)return`twenty `+(p===2e3?`hundred`:p<2010?`oh `+ONES[p%10]:numberToWords(p%100));var m=Math.floor(p/100),h=p%100;return numberToWords(m)+` `+(h<10?`oh `+ONES[h]:numberToWords(h))}),t=t.replace(/\b(\d{1,2}):(\d{2})(?:\s*(am|pm))?\b/gi,function(t,p,m,h){var g=parseInt(p),_=parseInt(m),v=numberToWords(g===0?12:g>12?g-12:g);return _===0?v+=` o'clock`:_<10?v+=` oh `+numberToWords(_):v+=` `+numberToWords(_),h&&(v+=` `+h.toLowerCase().replace(/(\w)/g,`$1 `).trim()),v}),t=t.replace(/\b(\d+)(?:st|nd|rd|th)\b/gi,function(t,p){return ordinalToWords(parseInt(p))}),t=t.replace(/\b(?:\(\d{3}\)\s?|\d{3}-)\d{3}-\d{4}\b/g,function(t){return t.replace(/\D/g,``).split(``).map(function(t){return ONES[parseInt(t)]}).join(` `)}),t=t.replace(/\b(\d+)\.(\d+)\b/g,function(t,p,m){return numberToWords(parseInt(p))+` point `+m.split(``).map(function(t){return ONES[parseInt(t)]}).join(` `)}),t=t.replace(/\b(\d+(?:\.\d+)?)%/g,function(t,p){var m=parseFloat(p);return numberToWords(Math.floor(m))+(m%1==0?``:` point `+(m.toString().split(`.`)[1]||``).split(``).map(function(t){return ONES[parseInt(t)]}).join(` `))+` percent`}),t=t.replace(/\b\d+\b/g,function(t){return numberToWords(parseInt(t))}),t}function expandAbbreviations(t){t=t.replace(/\b([a-z]+)\./gi,function(t,p){var m=p.toLowerCase();return ABBREVIATIONS[m]?ABBREVIATIONS[m]:t});var p=t.split(/\s+/),m=p.map(function(t){var p=t.toLowerCase().replace(/[^\w]/g,``);return ABBREVIATIONS[p]?t.replace(new RegExp(p,`gi`),ABBREVIATIONS[p]):t});return m.join(` `)}function expandText(t){return t=expandAbbreviations(t),t=expandNumbers(t),t.replace(/\s+/g,` `).trim()}var VERB_ENDINGS=[`ed`,`ing`,`es`,`s`,`en`,`er`,`ize`,`ise`,`fy`,`ate`],NOUN_ENDINGS=[`tion`,`sion`,`ness`,`ment`,`ity`,`ty`,`er`,`or`,`ist`,`ian`,`ism`,`age`,`ure`,`ence`,`ance`],ADJECTIVE_ENDINGS=[`able`,`ible`,`al`,`ial`,`ed`,`en`,`er`,`est`,`ful`,`ic`,`ish`,`ive`,`less`,`ly`,`ous`,`y`],DETERMINERS=[`the`,`a`,`an`,`this`,`that`,`these`,`those`,`my`,`your`,`his`,`her`,`its`,`our`,`their`],AUX_VERBS=[`am`,`is`,`are`,`was`,`were`,`be`,`being`,`been`,`have`,`has`,`had`,`having`,`do`,`does`,`did`,`doing`,`will`,`would`,`shall`,`should`,`can`,`could`,`may`,`might`,`must`],PREPOSITIONS=[`in`,`on`,`at`,`by`,`for`,`with`,`from`,`to`,`of`,`about`,`under`,`over`,`through`,`between`,`among`],COMMON_NOUNS=[`way`,`book`,`books`,`paper`,`time`,`people`,`world`,`life`,`hand`,`part`,`child`,`eye`,`woman`,`place`,`work`,`week`,`case`,`point`,`company`,`number`,`group`,`problem`,`fact`],IMPERATIVE_INDICATORS=[`please`,`don't`,`do`,`doesn't`,`never`],MODAL_VERBS=[`can`,`will`,`would`,`should`,`could`,`may`,`might`,`must`],SUBJECT_PRONOUNS=[`i`,`you`,`he`,`she`,`it`,`we`,`they`],PRONOUNS=utils.__spreadArray(utils.__spreadArray([],SUBJECT_PRONOUNS,!0),[`me`,`him`,`us`,`them`,`my`,`your`,`his`,`her`,`its`,`our`,`their`,`myself`,`yourself`,`himself`,`herself`,`itself`,`ourselves`,`yourselves`,`themselves`],!1),CONJUNCTIONS=[`and`,`but`,`or`,`nor`,`so`,`yet`,`for`,`as`,`if`,`than`,`that`,`though`,`while`,`because`,`since`,`unless`,`until`,`when`,`where`,`whether`],WH_WORDS=[`what`,`who`,`whom`,`whose`,`where`,`when`,`why`,`how`,`which`],FUNCTION_WORDS=new Set(utils.__spreadArray(utils.__spreadArray(utils.__spreadArray(utils.__spreadArray(utils.__spreadArray(utils.__spreadArray(utils.__spreadArray([],DETERMINERS,!0),PRONOUNS,!0),PREPOSITIONS,!0),AUX_VERBS,!0),MODAL_VERBS,!0),CONJUNCTIONS,!0),WH_WORDS,!0));function isFunctionWord(t,p){return!!(FUNCTION_WORDS.has(t.toLowerCase())||p&&/^(DT|IN|CC|PRP|MD|AUX|WP|WDT|WRB|TO|EX)$/.test(p))}var WEAK_MONO_RE=/^([^aeiouɑæɛɪɔʊʌəɝ]*)[æʌɛɔʊ]([^aeiouɑæɛɪɔʊʌəɝ]*)$/,WEAK_U_RE=/^([^aeiouɑæɛɪɔʊʌəɝjhw])u$/,WEAK_NUCLEUS_G=/[aeiouɑæɛɪɔʊʌəɝ]+/g;function reduceToWeakForm(t){var p=t.match(WEAK_NUCLEUS_G);if(!p||p.length>1)return t;var m=t.replace(/[ˈˌ]/g,``),h=m.replace(WEAK_MONO_RE,`$1ə$2`);return h===m?m.replace(WEAK_U_RE,`$1ə`):h}var SimplePOSTagger=function(){function t(){}return t.prototype.isLikelyNoun=function(t){for(var p=t.toLowerCase(),m=0,h=NOUN_ENDINGS;m<h.length;m++){var g=h[m];if(p.endsWith(g))return!0}return COMMON_NOUNS.includes(p)},t.prototype.tagWord=function(t,p){var m,h,g=t.toLowerCase();if(DETERMINERS.includes(g))return{word:t,pos:`DT`,confidence:.9};if(p&&p.length>=1){var _=(m=p[0])?.toLowerCase(),v=p.length>=2?(h=p[1])?.toLowerCase():void 0;if(_&&DETERMINERS.includes(_))return{word:t,pos:`!V`,confidence:.95};if(_&&IMPERATIVE_INDICATORS.includes(_)||_&&MODAL_VERBS.includes(_))return{word:t,pos:`V`,confidence:.9};if(_&&SUBJECT_PRONOUNS.includes(_))return{word:t,pos:`V`,confidence:.85};if(_&&AUX_VERBS.includes(_)||v&&DETERMINERS.includes(v))return{word:t,pos:`V`,confidence:.8};if(v&&this.isLikelyNoun(v))return{word:t,pos:`V`,confidence:.75};if(v===`to`)return{word:t,pos:`V`,confidence:.7};if(_&&PREPOSITIONS.includes(_))return{word:t,pos:`!V`,confidence:.7}}for(var y=0,b=VERB_ENDINGS;y<b.length;y++){var x=b[y];if(g.endsWith(x))return x===`ed`?{word:t,pos:`VBD`,confidence:.6}:x===`ing`?{word:t,pos:`V`,confidence:.6}:x===`s`&&g.length>2?{word:t,pos:`V`,confidence:.4}:{word:t,pos:`V`,confidence:.5}}for(var S=0,C=NOUN_ENDINGS;S<C.length;S++){var x=C[S];if(g.endsWith(x))return{word:t,pos:`!V`,confidence:.5}}for(var w=0,T=ADJECTIVE_ENDINGS;w<T.length;w++){var x=T[w];if(g.endsWith(x))return x===`ly`?{word:t,pos:`ADJ`,confidence:.6}:{word:t,pos:`!V`,confidence:.5}}return{word:t,pos:`!V`,confidence:.3}},t.prototype.tagWords=function(t){for(var p=[],m=0;m<t.length;m++){var h=t[m],g=[m>0?t[m-1]:``,m<t.length-1?t[m+1]:``].filter(function(t){return t});p.push(this.tagWord(h,g))}return p},t.prototype.tagSentence=function(t){var p=t.toLowerCase().split(/[\s,.!?;:()]+/).filter(function(t){return t.length>0});return this.tagWords(p)},t}(),simplePOSTagger=new SimplePOSTagger;const schedule=`ˈʃɛdjuːl`,tomato=`təˈmɑːtəʊ`,vase=`vɑːz`,herb=`hɜːb`,zebra=`ˈzɛbɹə`,lieutenant=`lɛfˈtɛnənt`;var lexical={schedule,tomato,vase,herb,zebra,lieutenant},lexicalData=Object.freeze({__proto__:null,default:lexical,herb,lieutenant,schedule,tomato,vase,zebra}),RP_LEXICAL=utils.resolveJson(lexicalData);function applyRPRules(t,p){var m=p;return m=m.replace(/([ˈˌ][^ˈˌaeiouæɑɒəɛɪʌʊɔ]*)ɝ/g,`$1ɜː`),m=m.replace(/ɝ/g,`ə`),m=m.replace(/aɪɹ(?![aeiouæɑɒəɛɪʌʊɔ])/g,`aɪə`).replace(/aʊɹ(?![aeiouæɑɒəɛɪʌʊɔ])/g,`aʊə`).replace(/ɑɹ(?![aeiouæɑɒəɛɪʌʊɔ])/g,`ɑː`).replace(/ɔɹ(?![aeiouæɑɒəɛɪʌʊɔ])/g,`ɔː`).replace(/ɛɹ(?![aeiouæɑɒəɛɪʌʊɔ])/g,`ɛə`).replace(/ɪɹ(?![aeiouæɑɒəɛɪʌʊɔ])/g,`ɪə`).replace(/ʊɹ(?![aeiouæɑɒəɛɪʌʊɔ])/g,`ʊə`),m=m.replace(/ɹ(?![aeiouæɑɒəɛɪʌʊɔ])/g,``),m=m.replace(/əː/g,`ɜː`),/[a-z]{2,}age$/.test(t)&&(m=m.replace(/[ɑɒæ](d?)ʒ$/,`ɑːʒ`)),/^su[a-z]/i.test(t)&&(m=m.replace(/^(ˈ?)su(?!ʃ)/,`$1sjuː`)),m}function transformAmericanToRP(t,p){var m=t.toLowerCase(),h=RP_LEXICAL[m];return h||applyRPRules(m,p)}for(var SUFFIXES=[{suffix:`ization`,ipa:`ɪzeɪʃən`,stress:`penult`,minBase:3},{suffix:`isation`,ipa:`ɪzeɪʃən`,stress:`penult`,minBase:3},{suffix:`ifications`,ipa:`ɪfɪkeɪʃənz`,stress:`penult`,minBase:3},{suffix:`ification`,ipa:`ɪfɪkeɪʃən`,stress:`penult`,minBase:3},{suffix:`ations`,ipa:`eɪʃənz`,stress:`penult`,minBase:3},{suffix:`ation`,ipa:`eɪʃən`,stress:`penult`,minBase:3},{suffix:`itions`,ipa:`ɪʃənz`,stress:`penult`,minBase:3},{suffix:`ition`,ipa:`ɪʃən`,stress:`penult`,minBase:3},{suffix:`utions`,ipa:`uʃənz`,stress:`penult`,minBase:3},{suffix:`ution`,ipa:`uʃən`,stress:`penult`,minBase:3},{suffix:`otions`,ipa:`oʊʃənz`,stress:`penult`,minBase:3},{suffix:`otion`,ipa:`oʊʃən`,stress:`penult`,minBase:3},{suffix:`etions`,ipa:`iʃənz`,stress:`penult`,minBase:3},{suffix:`etion`,ipa:`iʃən`,stress:`penult`,minBase:3},{suffix:`ctions`,ipa:`kʃənz`,stress:`penult`,minBase:3},{suffix:`ction`,ipa:`kʃən`,stress:`penult`,minBase:3},{suffix:`tions`,ipa:`ʃənz`,stress:`penult`,minBase:3},{suffix:`tion`,ipa:`ʃən`,stress:`penult`,minBase:3},{suffix:`sions`,ipa:`ʒənz`,stress:`penult`,minBase:3},{suffix:`sion`,ipa:`ʒən`,stress:`penult`,minBase:3},{suffix:`cians`,ipa:`ʃənz`,stress:`penult`,minBase:3},{suffix:`cian`,ipa:`ʃən`,stress:`penult`,minBase:3},{suffix:`abilities`,ipa:`əbɪlɪtiz`,stress:`antepenult`,minBase:3},{suffix:`ability`,ipa:`əbɪlɪti`,stress:`antepenult`,minBase:3},{suffix:`ibilities`,ipa:`əbɪlɪtiz`,stress:`antepenult`,minBase:3},{suffix:`ibility`,ipa:`əbɪlɪti`,stress:`antepenult`,minBase:3},{suffix:`alities`,ipa:`ælətiz`,stress:`antepenult`,minBase:4},{suffix:`ality`,ipa:`æləti`,stress:`antepenult`,minBase:4},{suffix:`ivities`,ipa:`ɪvətiz`,stress:`antepenult`,minBase:4},{suffix:`ivity`,ipa:`ɪvəti`,stress:`antepenult`,minBase:4},{suffix:`osities`,ipa:`ɑsətiz`,stress:`antepenult`,minBase:4},{suffix:`osity`,ipa:`ɑsəti`,stress:`antepenult`,minBase:4},{suffix:`arities`,ipa:`ɛɹətiz`,stress:`antepenult`,minBase:4},{suffix:`arity`,ipa:`ɛɹəti`,stress:`antepenult`,minBase:4},{suffix:`orities`,ipa:`ɔɹətiz`,stress:`antepenult`,minBase:4},{suffix:`ority`,ipa:`ɔɹəti`,stress:`antepenult`,minBase:4},{suffix:`ities`,ipa:`ətiz`,stress:`antepenult`,minBase:3,ipaAlts:[`ɪtiz`]},{suffix:`ity`,ipa:`əti`,stress:`antepenult`,minBase:3,ipaAlts:[`ɪti`]},{suffix:`ically`,ipa:`ɪkli`,stress:`antepenult`,minBase:3},{suffix:`icals`,ipa:`ɪkəlz`,stress:`antepenult`,minBase:3},{suffix:`ical`,ipa:`ɪkəl`,stress:`antepenult`,minBase:3},{suffix:`ics`,ipa:`ɪks`,stress:`penult`,minBase:3},{suffix:`ic`,ipa:`ɪk`,stress:`penult`,minBase:3},{suffix:`tial`,ipa:`ʃəl`,stress:`penult`,minBase:3},{suffix:`cial`,ipa:`ʃəl`,stress:`penult`,minBase:3},{suffix:`ial`,ipa:`iəl`,stress:`antepenult`,minBase:3},{suffix:`cious`,ipa:`ʃəs`,stress:`penult`,minBase:3},{suffix:`tious`,ipa:`ʃəs`,stress:`penult`,minBase:3},{suffix:`geous`,ipa:`dʒəs`,stress:`penult`,minBase:3},{suffix:`uous`,ipa:`juəs`,stress:`antepenult`,minBase:3},{suffix:`ious`,ipa:`iəs`,stress:`antepenult`,minBase:3},{suffix:`eous`,ipa:`iəs`,stress:`antepenult`,minBase:3},{suffix:`ances`,ipa:`ənsɪz`,stress:`penult`,minBase:3},{suffix:`ance`,ipa:`əns`,stress:`penult`,minBase:3},{suffix:`ences`,ipa:`ənsɪz`,stress:`penult`,minBase:3},{suffix:`ence`,ipa:`əns`,stress:`penult`,minBase:3},{suffix:`ants`,ipa:`ənts`,stress:`penult`,minBase:3},{suffix:`ant`,ipa:`ənt`,stress:`penult`,minBase:3},{suffix:`ents`,ipa:`ənts`,stress:`penult`,minBase:3},{suffix:`ent`,ipa:`ənt`,stress:`penult`,minBase:3},{suffix:`atively`,ipa:`ətɪvli`,stress:`antepenult`,minBase:3},{suffix:`atives`,ipa:`ətɪvz`,stress:`antepenult`,minBase:3},{suffix:`ative`,ipa:`ətɪv`,stress:`antepenult`,minBase:3},{suffix:`atory`,ipa:`ətɔɹi`,stress:`antepenult`,minBase:3},{suffix:`atories`,ipa:`ətɔɹiz`,stress:`antepenult`,minBase:3},{suffix:`ologies`,ipa:`ɑlədʒiz`,stress:`antepenult`,minBase:3},{suffix:`ology`,ipa:`ɑlədʒi`,stress:`antepenult`,minBase:3},{suffix:`ologists`,ipa:`ɑlədʒɪsts`,stress:`antepenult`,minBase:3},{suffix:`ologist`,ipa:`ɑlədʒɪst`,stress:`antepenult`,minBase:3},{suffix:`ographies`,ipa:`ɑɡɹəfiz`,stress:`antepenult`,minBase:3},{suffix:`ography`,ipa:`ɑɡɹəfi`,stress:`antepenult`,minBase:3},{suffix:`onomies`,ipa:`ɑnəmiz`,stress:`antepenult`,minBase:3},{suffix:`onomy`,ipa:`ɑnəmi`,stress:`antepenult`,minBase:3},{suffix:`ological`,ipa:`əlɑdʒɪkəl`,stress:`antepenult`,minBase:3},{suffix:`esque`,ipa:`ɛsk`,stress:`final`,minBase:3},{suffix:`ettes`,ipa:`ɛts`,stress:`final`,minBase:3},{suffix:`ette`,ipa:`ɛt`,stress:`final`,minBase:3},{suffix:`eers`,ipa:`ɪɹz`,stress:`final`,minBase:3},{suffix:`eer`,ipa:`ɪɹ`,stress:`final`,minBase:3},{suffix:`ees`,ipa:`iz`,stress:`final`,minBase:3},{suffix:`ee`,ipa:`i`,stress:`final`,minBase:3},{suffix:`ese`,ipa:`iz`,stress:`final`,minBase:3},{suffix:`aire`,ipa:`ɛɹ`,stress:`final`,minBase:3},{suffix:`oons`,ipa:`unz`,stress:`final`,minBase:3},{suffix:`oon`,ipa:`un`,stress:`final`,minBase:3},{suffix:`nesses`,ipa:`nəsɪz`,stress:`neutral`,minBase:3},{suffix:`lessness`,ipa:`ləsnəs`,stress:`neutral`,minBase:3},{suffix:`lessly`,ipa:`ləsli`,stress:`neutral`,minBase:3},{suffix:`fulness`,ipa:`fəlnəs`,stress:`neutral`,minBase:3},{suffix:`fully`,ipa:`fəli`,stress:`neutral`,minBase:3},{suffix:`ingly`,ipa:`ɪŋli`,stress:`neutral`,minBase:3},{suffix:`ness`,ipa:`nəs`,stress:`neutral`,minBase:3},{suffix:`less`,ipa:`ləs`,stress:`neutral`,minBase:3},{suffix:`ful`,ipa:`fəl`,stress:`neutral`,minBase:3},{suffix:`ship`,ipa:`ʃɪp`,stress:`neutral`,minBase:3},{suffix:`hood`,ipa:`hʊd`,stress:`neutral`,minBase:3},{suffix:`dom`,ipa:`dəm`,stress:`neutral`,minBase:3},{suffix:`ish`,ipa:`ɪʃ`,stress:`neutral`,minBase:3},{suffix:`ments`,ipa:`mənts`,stress:`neutral`,minBase:3},{suffix:`ment`,ipa:`mənt`,stress:`neutral`,minBase:3},{suffix:`ism`,ipa:`ɪzəm`,stress:`neutral`,minBase:3},{suffix:`isms`,ipa:`ɪzəmz`,stress:`neutral`,minBase:3},{suffix:`ists`,ipa:`ɪsts`,stress:`neutral`,minBase:3},{suffix:`ist`,ipa:`ɪst`,stress:`neutral`,minBase:3},{suffix:`ward`,ipa:`wɝd`,stress:`neutral`,minBase:3},{suffix:`wards`,ipa:`wɝdz`,stress:`neutral`,minBase:3},{suffix:`wise`,ipa:`waɪz`,stress:`neutral`,minBase:3},{suffix:`ly`,ipa:`li`,stress:`neutral`,minBase:4},{suffix:`ings`,ipa:`ɪŋz`,stress:`neutral`,minBase:3},{suffix:`ing`,ipa:`ɪŋ`,stress:`neutral`,minBase:3},{suffix:`ied`,ipa:`id`,stress:`neutral`,minBase:3,recover:{strip:``,add:`y`},ipaAlts:[`aɪd`]},{suffix:`ies`,ipa:`iz`,stress:`neutral`,minBase:3,recover:{strip:``,add:`y`},ipaAlts:[`aɪz`]},{suffix:`ed`,ipa:`d`,stress:`neutral`,minBase:3,ipaAlts:[`t`,`ɪd`,`əd`]},{suffix:`est`,ipa:`ɪst`,stress:`neutral`,minBase:3,ipaAlts:[`əst`]},{suffix:`ers`,ipa:`ɝz`,stress:`neutral`,minBase:3},{suffix:`er`,ipa:`ɝ`,stress:`neutral`,minBase:3},{suffix:`es`,ipa:`z`,stress:`neutral`,minBase:3,ipaAlts:[`ɪz`,`s`]},{suffix:`s`,ipa:`z`,stress:`neutral`,minBase:3,ipaAlts:[`s`]},{suffix:`ably`,ipa:`əbli`,stress:`neutral`,minBase:3},{suffix:`able`,ipa:`əbəl`,stress:`neutral`,minBase:3},{suffix:`ibly`,ipa:`əbli`,stress:`neutral`,minBase:3},{suffix:`ible`,ipa:`əbəl`,stress:`neutral`,minBase:3},{suffix:`izes`,ipa:`aɪzɪz`,stress:`antepenult`,minBase:3},{suffix:`ized`,ipa:`aɪzd`,stress:`antepenult`,minBase:3},{suffix:`izing`,ipa:`aɪzɪŋ`,stress:`antepenult`,minBase:3},{suffix:`ize`,ipa:`aɪz`,stress:`antepenult`,minBase:3},{suffix:`ises`,ipa:`aɪzɪz`,stress:`antepenult`,minBase:3},{suffix:`ise`,ipa:`aɪz`,stress:`antepenult`,minBase:3},{suffix:`ifies`,ipa:`ɪfaɪz`,stress:`antepenult`,minBase:3},{suffix:`ified`,ipa:`ɪfaɪd`,stress:`antepenult`,minBase:3},{suffix:`ify`,ipa:`ɪfaɪ`,stress:`antepenult`,minBase:3},{suffix:`fies`,ipa:`faɪz`,stress:`antepenult`,minBase:3},{suffix:`fied`,ipa:`faɪd`,stress:`antepenult`,minBase:3},{suffix:`ously`,ipa:`əsli`,stress:`antepenult`,minBase:3},{suffix:`ousness`,ipa:`əsnəs`,stress:`antepenult`,minBase:3},{suffix:`ous`,ipa:`əs`,stress:`penult`,minBase:3}],BY_LEN=new Map,maxLen=0,_i=0,SUFFIXES_1=SUFFIXES;_i<SUFFIXES_1.length;_i++){var e=SUFFIXES_1[_i];maxLen=Math.max(maxLen,e.suffix.length),BY_LEN.has(e.suffix.length)||BY_LEN.set(e.suffix.length,[]),BY_LEN.get(e.suffix.length).push(e)}var MAX_SUFFIX_LEN=Math.max.apply(Math,Array.from(BY_LEN.keys()));function matchSuffix(t){for(var p,m=Math.min(MAX_SUFFIX_LEN,t.length-1);m>=1;m--){var h=BY_LEN.get(m);if(h)for(var g=t.slice(-m),_=0,v=h;_<v.length;_++){var y=v[_];if(y.suffix===g){var b=t.slice(0,-m);if(y.recover)if(b.endsWith(y.recover.strip))b=b.slice(0,b.length-y.recover.strip.length)+y.recover.add;else if(y.recover.strip!==``)continue;else b+=y.recover.add;if(!(b.length<((p=y.minBase)??3))&&!(y.baseGuard&&!y.baseGuard.test(b))){var x=[];return/^[aeiouy]/.test(y.suffix)&&!/[aeiouy]$/.test(b)&&x.push(b+`e`),(y.suffix===`ed`||y.suffix===`ing`||y.suffix===`er`||y.suffix===`est`)&&b.length>=3&&b[b.length-1]===b[b.length-2]&&!`aeiouy`.includes(b[b.length-1])&&x.push(b.slice(0,-1)),y.suffix===`ation`||y.suffix===`ations`?x.push(b+`ate`):y.suffix===`ition`||y.suffix===`itions`?x.push(b+`ite`,b+`ish`):y.suffix===`otion`||y.suffix===`otions`?x.push(b+`ote`):y.suffix===`ution`||y.suffix===`utions`?x.push(b+`ute`):y.suffix===`ction`||y.suffix===`ctions`?x.push(b+`ct`):y.suffix===`sion`||y.suffix===`sions`?x.push(b+`se`,b+`de`,b+`d`,b+`t`):(y.suffix===`ity`||y.suffix===`ities`)&&x.push(b+`e`,b+`ate`),{entry:y,base:b,baseAlts:x}}}}}return null}function decompose(t,p){for(var m=[],h=t,g=[],_=0;_<p;_++){var v=matchSuffix(h);if(!v)break;m.push({entry:v.entry,before:h,after:v.base,afterAlts:v.baseAlts}),h=v.base,g=v.baseAlts}return{base:h,baseAlts:g,steps:m}}function reduces(t){return t.reduces===void 0?t.stress!==`neutral`:t.reduces}var IPA_VOWELS=new Set(`aeiouæɛɪɔʊʌəɝ`);function countIpaSyllables(t){for(var p=0,m=!1,h=0,g=t;h<g.length;h++){var _=g[h];IPA_VOWELS.has(_)?(m||p++,m=!0):m=!1}return p}function dictStressIdx(t){for(var p=0,m=!1,h=0,g=t;h<g.length;h++){var _=g[h];if(_===`ˈ`)return p;IPA_VOWELS.has(_)?(m||p++,m=!0):_!==`ˌ`&&(m=!1)}return-1}function latinStress(t,p){if(t<=1||t===2)return{primary:0};var m=t-2;return p(m)?{primary:m}:{primary:Math.max(0,t-3)}}function assignStress$1(t){var p,m=t.syllableCount,h=t.suffix;if(m<=0||m===1)return{primary:0};if(h)switch(h.stress){case`final`:return withSecondary(m-1);case`penult`:return withSecondary(Math.max(0,m-2));case`antepenult`:return withSecondary(Math.max(0,m-3));case`neutral`:if(t.baseStress!==void 0)return withSecondary(t.baseStress);break}return latinStress(m,(p=t.isHeavy)??(function(){return!1}))}function withSecondary(t){var p=t-2;return p>=0?{primary:t,secondary:p}:{primary:t}}var VOWELS$2=new Set(`aeiouæɛɪɔʊʌəɝ`),LONG_VOWEL_STARTS=new Set(`eoauɔ`),DIPHTHONG_FOLLOWERS=new Set(`ɪʊ`);function findNuclei(t){for(var p=[],m=0;m<t.length;)if(VOWELS$2.has(t[m])){for(var h=m;m<t.length&&VOWELS$2.has(t[m]);)m++;p.push([h,m])}else m++;return p}function isLongVowel(t){return t.length>=2&&LONG_VOWEL_STARTS.has(t[0])&&DIPHTHONG_FOLLOWERS.has(t[1])?!0:t===`i`||t===`u`||t===`ɝ`}function reduceUnstressedVowels(t,p,m){m===void 0&&(m={});for(var h=m.reduceLong,g=h===void 0?!1:h,_=m.happyTensing,v=_===void 0?!0:_,y=findNuclei(t),b=[],x=0,S=0;S<y.length;S++){var C=y[S],w=C[0],T=C[1];b.push(t.slice(x,w));var E=t.slice(w,T);p.has(S)||!g&&isLongVowel(E)?b.push(E):b.push(reduceForContext(E,t,T,S===y.length-1,v)),x=T}return b.push(t.slice(x)),b.join(``)}function reduceForContext(t,p,m,h,g){return p[m]===`ɹ`?`ɝ`:g&&h&&m===p.length&&(t===`i`||t===`ɪ`)?`i`:`ə`}function stripStress(t){return t.replace(/[ˈˌ]/g,``)}function insertStressMark(t,p,m){var h=findNuclei(t);if(p<0||p>=h.length)return t;for(var g=h[p][0],_=g;_>0;){var v=t[_-1];if(v===`ˈ`||v===`ˌ`||`aeiouæɛɪɔʊʌəɝ`.includes(v))break;_--}return t.slice(0,_)+m+t.slice(_)}function predictPrincipled(p,m){var h=decompose(p,1);if(h.steps.length===0)return null;for(var g=h.steps[0].entry,_=h.steps[0].after,v=h.steps[0].afterAlts,y=/^[aeiouy]/.test(g.suffix),b=y?utils.__spreadArray(utils.__spreadArray([],v,!0),[_],!1):utils.__spreadArray([_],v,!0),x=null,S=null,C=0,w=b;C<w.length;C++){var T=w[C],E=m(T);if(E!==void 0){x=T,S=E;break}}if(S===null||x===null)return null;var D=dictStressIdx(S),O=stripStress(S);if(x!==_){var k=x.slice(_.length),A=function(t){return O.endsWith(t)?(O=O.slice(0,-t.length),!0):!1};switch(k){case`ate`:A(`eɪt`)||A(`ət`);break;case`ite`:A(`aɪt`)||A(`ɪt`);break;case`ote`:A(`oʊt`);break;case`ute`:A(`jut`)||A(`ut`);break;case`ct`:A(`kt`);break;case`pt`:A(`pt`);break}}var j=O+g.ipa,M=countIpaSyllables(j),N=assignStress$1({syllableCount:M,suffix:g,baseStress:D>=0?D:void 0}),P=new Set([N.primary]);N.secondary!==void 0&&P.add(N.secondary);var F=reduces(g)?reduceUnstressedVowels(j,P):j,I=F;return I=insertStressMark(I,N.primary,`ˈ`),N.secondary!==void 0&&(I=insertStressMark(I,N.secondary,`ˌ`)),{ipa:I,base:x,suffix:g,stress:N}}var VOWELS$1=`aeiouɑæɛɪɔʊʌəɝ`,INIT_AA_RE=/^([ˈˌ])?ɑɑ/;function collapseInitialDoubleA(t){var p=t.charCodeAt(0);return p!==593&&p!==712&&p!==716?t:t.replace(INIT_AA_RE,`$1ɑ`)}function simplifyDtFinal(t){var p=t.length;return p<2||t.charCodeAt(p-1)!==116||t.charCodeAt(p-2)!==100?t:t.slice(0,p-2)+`t`}var ED_VOICELESS=`pkfθsʃ`,ED_VOICED_NON_TD=`bʒvzðmnŋɫlɹjɡɑæɛɪɔʊʌəɝaeiouy`;function fixPastTenseED(t,p){if(p!==void 0&&!p.endsWith(`ed`))return t;var m=t.length;if(m<3||t.charCodeAt(m-1)!==100||t.charCodeAt(m-2)!==601)return t;var h=t[m-3];return h===`t`||h===`d`?t:ED_VOICELESS.indexOf(h)>=0?t.slice(0,-2)+`t`:ED_VOICED_NON_TD.indexOf(h)>=0?t.slice(0,-2)+`d`:t}function dropSilentH(t){if(t.indexOf(`h`)<0)return t;for(var p=``,m=0,h=0;h<t.length;h++)if(t[h]===`h`){var g=t[h+1],_=g!==void 0&&VOWELS$1.indexOf(g)>=0;_||(p+=t.slice(m,h),m=h+1)}return m===0?t:p+t.slice(m)}var WEAK_SCHWA_WORDS=new Set([`the`]);function normalizeStrut(t,p){if(t.indexOf(`ʌ`)<0&&t.indexOf(`ə`)<0)return t;for(var m=p!==void 0&&WEAK_SCHWA_WORDS.has(p),h=``,g=0;g<t.length;g++){var _=t[g];if(_!==`ə`&&_!==`ʌ`){h+=_;continue}for(var v=!1,y=g-1;y>=0;y--){var b=t[y];if(b===`ˈ`||b===`ˌ`){v=!0;break}if(VOWELS$1.includes(b))break}h+=v&&!m?`ʌ`:`ə`}return h}var DERHOTIC_RE=/ɝ([ˈˌ])([aeiouɑæɛɪɔʊʌəɝ])/g;function deRhoticBeforeStress(t){return t.indexOf(`ɝ`)<0?t:t.replace(DERHOTIC_RE,`ə$1ɹ$2`)}var FLEECE_NEAR_RE=/iɹ(?![aeiouɑæɛɪɔʊʌəɝ])/g;function laxFleeceBeforeCodaR(t){return t.indexOf(`iɹ`)<0?t:t.replace(FLEECE_NEAR_RE,`ɪɹ`)}var RHOTIC_IR_RE=/ɪɹ/g;function coalesceUnstressedIR(t){return t.indexOf(`ɪɹ`)<0?t:t.replace(RHOTIC_IR_RE,function(p,m){for(var h=m-1;h>=0;h--){var g=t[h];if(g===`ˈ`||g===`ˌ`)return`ɪɹ`;if(VOWELS$1.indexOf(g)>=0)break}return`ɝ`})}var PLURAL_VZ_RE=/(oʊ|aɪ|eɪ|ɔɪ|aʊ)ɪz$/;function simplifyPluralAfterVowel(t){return t.endsWith(`ɪz`)?t.replace(PLURAL_VZ_RE,`$1z`):t}var SYLLABIC_ES_RE=/([szʃʒ])ɪz$/;function weakVowelInflection(t){return t.endsWith(`ɪz`)?t.replace(SYLLABIC_ES_RE,`$1əz`):t}var SYLLABIC_L_CONS=`bcdfgɡhjkmnpqstvwxzðθʃʒŋɹɫ`;function epenthesizeSyllabicL(t){if(t.indexOf(`l`)<0&&t.indexOf(`ɫ`)<0)return t;for(var p=``,m=0,h=1;h<t.length-1;h++){var g=t[h];if(!(g!==`l`&&g!==`ɫ`)){var _=t[h-1],v=t[h+1];SYLLABIC_L_CONS.indexOf(_)>=0&&SYLLABIC_L_CONS.indexOf(v)>=0&&(p+=t.slice(m,h)+`ə`,m=h)}}return m===0?t:p+t.slice(m)}var HIATUS_IR_RE=/ɪ([ˈˌ]?)([aeiouɑæɛɔʊʌəɝ])/g,DIPHTHONG_PRE_I=`eaoɔ`;function tenseHiatusI(t){return t.indexOf(`ɪ`)<0?t:t.replace(HIATUS_IR_RE,function(p,m,h,g){var _=g;if(_>0&&DIPHTHONG_PRE_I.indexOf(t[_-1])>=0)return p;for(var v=_-1;v>=0;v--){var y=t[v];if(y===`ˈ`)return p;if(y===`ˌ`||VOWELS$1.indexOf(y)>=0)break}return`i`+m+h})}var ICALLY_RE=/ɪkə[lɫ]i$/;function elideIcallySchwa(t){return t.endsWith(`i`)?t.replace(ICALLY_RE,`ɪkli`):t}function addInitialSecondary(t){var p=t.indexOf(`ˈ`);if(p<0)return t;for(var m=0,h=!1,g=0;g<p;g++){var _=t[g];if(_===`ˌ`)return t;VOWELS$1.indexOf(_)>=0?(h||m++,h=!0):_!==`ˈ`&&(h=!1)}if(m<2)return t;for(var v=-1,g=0;g<t.length;g++)if(VOWELS$1.indexOf(t[g])>=0){v=g;break}if(v<0||t[v]===`ə`)return t;for(var y=v;y>0&&VOWELS$1.indexOf(t[y-1])<0&&t[y-1]!==`ˈ`&&t[y-1]!==`ˌ`;)y--;return t.slice(0,y)+`ˌ`+t.slice(y)}function applyHappyTensing(t){var p=t.length;if(p===0||t.charCodeAt(p-1)!==618)return t;var m=t[p-2];if(m&&`eaoɔ`.indexOf(m)>=0)return t;for(var h=p-2;h>=0;h--){var g=t[h];if(g===`ˈ`)return t;if(VOWELS$1.indexOf(g)>=0)break}return t.slice(0,p-1)+`i`}function applyPhonotactics(t,p){var m=t;return m=collapseInitialDoubleA(m),m=simplifyDtFinal(m),m=fixPastTenseED(m,p),m=dropSilentH(m),m=normalizeStrut(m,p),m=laxFleeceBeforeCodaR(m),m=deRhoticBeforeStress(m),m=coalesceUnstressedIR(m),m=tenseHiatusI(m),m=simplifyPluralAfterVowel(m),m=weakVowelInflection(m),m=epenthesizeSyllabicL(m),m=elideIcallySchwa(m),m=addInitialSecondary(m),m=applyHappyTensing(m),m}var POST_PROC_RULES=[[/([pbtdkɡfvszʃʒθðmnŋlɹhjwɫ])\1/g,`$1`],[/sʒ/g,`ʃ`],[/əɹ/g,`ɝ`],[/(?<=[^aeiouæɛɪɑɔʌʊ])ɪɹɝ$/,`ɝɝ`],[/n([kɡ])/g,`ŋ$1`],[/^mk/,`mək`],[/ɹɪtʃ$/,`ɹɪk`],[/ɡdʒ$/,`ɡ`],[/(?<=[aɑɔɛɪouəɝ])dʒɝ$/,`ɡɝ`],[/ətʃ$/,`ək`],[/([bdfɡhklmnpɹstzv])ə(ʃ|dʒ)əs$/,`$1eɪ$2əs`],[/([^w])əʃən$/,`$1eɪʃən`],[/oʊɹ/g,`ɔɹ`],[/[ɑə][ɛə]$/,`oʊ`],[/oʊ([ntplm])ɪk/g,`ɑ$1ɪk`],[/oʊnəm/g,`ɑnəm`],[/oʊmɪtɝ/g,`ɑmɪtɝ`],[/oʊɡɹəf([iɝ])/g,`ɑɡɹəf$1`],[/oʊmɪnən([ts])/g,`ɑmənən$1`],[/oʊdʒɪk$/,`ɑdʒɪk`],[/ənoʊ/g,`ɑnoʊ`],[/ætɪv$/,`ətɪv`],[/ɑɹi$/,`ɛɹi`],[/[æɪ]bli$/,`əbli`],[/ɑl([dtskp])/g,`oʊl$1`],[/əhl/g,`ɑl`],[/([pbtdkɡfvszʃθmnlhjwɫ])ɹoʊst/g,`$1ɹɑst`],[/bɹoʊd/g,`bɹɔd`],[/^ʌnɪ/,`junɪ`],[/([kɡdbptfvszʃʒmnlɹwj])əəs$/g,`$1uəs`],[/ksɪəs/g,`kʃəs`],[/stjʊɹ/g,`stʃɝ`],[/([tsn])aɪv$/g,`$1ɪv`],[/([^aeiouæɑɔɛɪuoəɝʌ])ɪtɪv$/g,`$1ətɪv`],[/ɡuʃ/g,`ɡwɪʃ`],[/mək(ɝ|ɪŋ)$/,`meɪk$1`],[/məstɝ$/,`mæstɝ`],[/ɪ([nlkfvmt])eɪʃən$/,`ə$1eɪʃən`],[/ɪ([nk])eɪt$/,`ə$1eɪt`],[/(s|dʒ)ɪbəl$/g,`$1əbəl`],[/ʌmɪnəs$/,`umənəs`],[/pənənt$/,`poʊnənt`],[/ɡɹɛɡeɪt$/,`ɡɹəɡeɪt`],[/tɪənɛɹi$/,`ʃənɛɹi`],[/ɝɹeɪʃən$/,`ɝeɪʃən`],[/ɪnɪti$/,`ɪnəti`],[/ɛntɛɹi$/,`əntɛɹi`],[/ɪtud$/,`ətud`],[/oʊleɪt$/,`ɑleɪt`],[/aʊɹ(?=[^aeiouæɛɪɑɔʌʊ])/g,`uɹ`],[/æ{2,}/g,`ɑ`],[/ɪæ$/,`iə`],[/zjʊɹ$/,`ʒɝ`],[/nð$/,`nθ`],[/([lɹ])ð/g,`$1θ`]],GERMANIC_EI_SUFFIX_RE=/(?:berg|burg|stein(?:er)?|heim(?:er)?|bach|wald|feld|brand|mann|kamp|wein|bein|hoff|muth|dorf|tal|ler|ner|sen|born|mark|meier|eier|meister|eister|hardt|ardt|lein|heit|heid|meyer|eyer|weiser|eiser|ecker|decker|elman|eman|hein|eitel|itel|einl|eindl|indl|berger|egger|eiter|iter|wenger|enger|enson|itas|linger|fried|zig|eis|eiden|eider|hold|gold|zel|eineke|eincke|eineck|einke)$/,POST_LEX_RULES=[{when:function(t){return t.startsWith(`aa`)},re:/^æ+/,sub:`ɑ`},{when:function(t){return t.endsWith(`erate`)||t.length>=9},re:/[ɛɔ]ɹeɪt(ɝ?)$/,sub:`ɝeɪt$1`},{when:function(t,p){return p>=3},re:/eɪdʒ$/,sub:`ɪdʒ`},{when:function(t){return t.includes(`asiv`)},re:/æsɪv/,sub:`eɪsɪv`},{when:function(t){return t.endsWith(`ator`)},re:/([^w])ətɝ$/,sub:`$1eɪtɝ`},{when:function(t,p){return t.endsWith(`mony`)&&p>=3},re:/məni$/,sub:`moʊni`},{when:function(t){return!t.endsWith(`sense`)&&!t.endsWith(`fense`)},re:/([ɪɛ])ns$/,sub:`əns`},{when:function(t){return t.endsWith(`inger`)},re:/ndʒɝ$/,sub:`ŋɝ`},{when:function(t){return t.endsWith(`unger`)||t.endsWith(`onger`)},re:/ndʒɝ$/,sub:`ŋɡɝ`},{when:function(t){return t===`ache`||t.endsWith(`ache`)&&t.length>=7},re:/[æə]tʃ[əɪ]?$/,sub:`eɪk`},{when:function(t,p){return t.endsWith(`ard`)&&p>=2&&!/[yh]ard$/.test(t)&&!/card$/.test(t)&&!/(?:(?<!g)gard|guard)$/.test(t)&&!/bard$/.test(t)},re:/ɑɹd$/,sub:`ɝd`},{when:function(t){return/(?:ect|ept|ext)$/.test(t)},re:/ə([kp]t|kst)$/,sub:`ɛ$1`},{when:function(t,p){return t.endsWith(`end`)&&p>=2},re:/ənd$/,sub:`ɛnd`},{when:function(t){return t.endsWith(`itis`)},re:/ɪtɪs$/,sub:`aɪtɪs`},{when:function(t){return t.length>=7&&t.endsWith(`tice`)||t.length>=7&&t.endsWith(`vice`)},re:/aɪs$/,sub:`ɪs`},{when:function(t){return t.endsWith(`ange`)&&!t.endsWith(`lange`)},re:/ændʒ$/,sub:`eɪndʒ`},{when:function(t){return/(?:erous|arous|orous|urous)$/.test(t)},re:/ɪɹəs$/,sub:`ɝəs`},{when:function(t){return/(?:ious|eous)$/.test(t)},re:/ɪəs$/,sub:`iəs`},{when:function(t){return/(?:aven|avor|avour)$/.test(t)},re:/æv(ɝ|ən)$/,sub:`eɪv$1`},{when:function(t){return t.endsWith(`amous`)},re:/æm(əs)$/,sub:`eɪm$1`},{when:function(t){return/ion$/.test(t)&&!/(?:tion|sion)$/.test(t)},re:/ɪən$/,sub:`iən`},{when:function(t){return!t.endsWith(`cission`)},re:/sɪʃən$/,sub:`zɪʃən`},{when:function(t){return t.length>=9},re:/ɪɹeɪʃən$/,sub:`ɝeɪʃən`},{when:function(t){return t.endsWith(`iment`)},re:/ɪmənt$/,sub:`əmənt`},{when:function(t){return t.endsWith(`ancy`)},re:/ænsi$/,sub:`ənsi`},{when:function(t){return t.endsWith(`erage`)||t.endsWith(`erature`)},re:/ɛɹ/g,sub:`ɝ`},{when:function(t){return t.startsWith(`mechan`)},re:/tʃ/,sub:`k`},{when:function(t){return t.startsWith(`ei`)&&!/^ei(ght|ther)/.test(t)},re:/^eɪ/,sub:`aɪ`},{when:function(t){return GERMANIC_EI_SUFFIX_RE.test(t)&&t.includes(`ei`)&&!t.includes(`eight`)},re:/eɪ/g,sub:`aɪ`},{when:function(t){return t.includes(`ei`)&&(t.startsWith(`klein`)||t.startsWith(`drei`)||t.startsWith(`breit`)||t.startsWith(`mein`)||t.startsWith(`meio`)||t.startsWith(`wei`)||t.startsWith(`feig`)&&!t.startsWith(`feigh`)||t.startsWith(`hei`)&&!/^hei(?:nous|fer|r$|res|ress)/.test(t)||t.startsWith(`lei`)&&t.length>=6&&!/^lei(?:sure|s$)/.test(t)||t.startsWith(`pf`)&&t.includes(`ei`))},re:/eɪ/g,sub:`aɪ`},{when:function(t){return t.includes(`seism`)},re:/eɪ/g,sub:`aɪ`},{when:function(t){return t.includes(`reif`)&&t.length>=5},re:/ɹeɪf/,sub:`ɹaɪf`},{when:function(t){return t.length>=5&&/eidt?$/.test(t)},re:/eɪ([dt]?)$/,sub:`aɪ$1`},{when:function(t){return/(?:thet|theis|thesis|thesia|thentic|theon)/.test(t)},re:/ð/g,sub:`θ`},{when:function(t){return/ach(?:en|er)$/.test(t)},re:/tʃ([ɛəɪ])/,sub:`k$1`},{when:function(t){return/^g[ei]/.test(t)&&/(?:berg|stein(?:er)?|heim(?:er)?|bach|wald|feld|brand|mann|kamp|wein|bein)$/.test(t)},re:/^dʒ/,sub:`ɡ`},{when:function(t){return/(?:berg|burg)$/.test(t)&&(t.includes(`ge`)||t.includes(`gi`))&&!t.includes(`nge`)&&!t.includes(`ngi`)},re:/dʒ/g,sub:`ɡ`},{when:function(t){return t.startsWith(`berg`)&&t.length>=6&&!/(?:ey|y)$/.test(t)||t.startsWith(`mcg`)&&t.length>=5&&!/orge$/.test(t)},re:/dʒ/g,sub:`ɡ`},{when:function(t){return t.startsWith(`beg`)&&t.length>=5},re:/^bɪdʒ/,sub:`bɪɡ`},{when:function(t){return t.length>=5&&(t.startsWith(`gei`)||/^gel[dbns]/.test(t)||t.startsWith(`get`))||/^gi[dvm]/.test(t)||t.startsWith(`gig`)&&t.length>=4&&!/^gig(?:i$|lio|lia|lo|ot|ol)/.test(t)||t.startsWith(`ges`)&&t.length>=5&&!/^gest(?:ure|iculat|ation|ural|at|alt|urin|al)/.test(t)&&t!==`geske`||t.startsWith(`geh`)&&t.length>=5&&!/^geh(?:le|res|rke)$/.test(t)},re:/^dʒ/,sub:`ɡ`},{when:function(t){return/(?:ingen|angen)$/.test(t)&&t.length>=7},re:/dʒ([əɛɪ]n)$/,sub:`ɡ$1`},{when:function(t){return t.includes(`eigen`)||t.includes(`eig`)&&(t.startsWith(`wei`)||t.startsWith(`feig`)&&!t.startsWith(`feigh`))},re:/dʒ([əɛɪ])/g,sub:`ɡ$1`},{when:function(t){return t.endsWith(`gel`)&&t.length>=5&&!/(?:cudgel|gudgel|kegel|nigel|rigel|bagel|angel|evangel|rangel|dgel)$/.test(t)},re:/dʒ([əɛɪ][lɫ]?)$/,sub:`ɡ$1`},{when:function(t){return t.endsWith(`ger`)&&(t.length>=7&&/[bcdfghjklmnpqrstvwxyz]{2}ger$/.test(t)||t.length>=8&&!/(?:anger|inger|onger|enger|ager)$/.test(t))},re:/dʒɝ$/,sub:`ɡɝ`},{when:function(t){return t.endsWith(`gers`)&&t.length>=7&&!/(?:[ao]ngers|agers|ingers|ungers)$/.test(t)},re:/dʒɝz$/,sub:`ɡɝz`},{when:function(t){return t.endsWith(`gen`)&&t.length>=7&&/[bcdfghjklmnpqrstvwxyz]{2}gen$/.test(t)},re:/dʒən$/,sub:`ɡən`},{when:function(t){return t.endsWith(`ford`)&&t.length>4||/(?:worth|world|works?)$/.test(t)},re:/ɔɹ(d|θ|ld|ks?)$/,sub:`ɝ$1`},{when:function(t){return t.endsWith(`fort`)&&t.length>4},re:/fɔɹt$/,sub:`fɝt`},{when:function(t){return t.includes(`oe`)&&t.length>=4},re:/ɑɛ/g,sub:`oʊ`},{when:function(t){return t.includes(`ae`)&&t.length>=4},re:/æɛ/g,sub:`ɛ`},{when:function(t){return t.includes(`eo`)&&!t.includes(`ae`)&&t.length>=4},re:/ɛoʊ/g,sub:`ioʊ`},{when:function(t){return t.endsWith(`ouquet`)},re:/aʊkw[ɛə]t$/,sub:`ukeɪ`},{when:function(t){return t.endsWith(`quet`)&&!t.endsWith(`nquet`)&&!t.endsWith(`mquet`)},re:/kw[ɛə]t$/,sub:`keɪ`},{when:function(t){return t.endsWith(`ochet`)},re:/tʃ[ɛə]t$/,sub:`ʃeɪ`},{when:function(t){return t.endsWith(`achet`)},re:/[ɛɪə]t$/,sub:`eɪ`},{when:function(t){return t.endsWith(`alet`)},re:/[ɛɪə]t$/,sub:`eɪ`},{when:function(t){return t.endsWith(`ette`)&&t.length>=5},re:/([^ɛɪæaouʊə])t$/,sub:`$1ɛt`},{when:function(t){return t.endsWith(`oise`)&&t.length>=7&&!/^(?:noise|turquoise|vichyssoise|francoise|laframboise)/.test(t)},re:/ɔɪz$/,sub:`əs`},{when:function(t){return t.endsWith(`augh`)&&t.length>4},re:/ə$/,sub:`ɔ`},{when:function(t){return t.endsWith(`borough`)&&t.length>7},re:/[əʌ]f$/,sub:`oʊ`},{when:function(t){return t.endsWith(`urious`)&&t.length>=7},re:/^([kf])ʌɹ/,sub:`$1jʊɹ`},{when:function(t){return/olumn|olemn/.test(t)},re:/oʊl([əm])/,sub:`ɑl$1`},{when:function(t){return t.startsWith(`acou`)},re:/aʊ/,sub:`u`},{when:function(t){return t.endsWith(`gue`)&&t.length>=4&&!/^(?:argue|ague|montague)$/.test(t)},re:/ɡu$/,sub:`ɡ`},{when:function(t){return t.endsWith(`ois`)&&!t.endsWith(`quois`)&&!t.endsWith(`lois`)&&!t.endsWith(`bois`)},re:/ɔɪs$/,sub:`wɑ`},{when:function(t){return t.endsWith(`ais`)},re:/eɪs$/,sub:`eɪ`},{when:function(t){return t.endsWith(`oir`)},re:/ɔɪɹ$/,sub:`wɑɹ`},{when:function(t){return t.endsWith(`oux`)},re:/aʊks?$/,sub:`u`},{when:function(t){return t.includes(`oup`)},re:/aʊp/g,sub:`up`},{when:function(t){return t.includes(`oui`)||t.includes(`ouill`)},re:/aʊɪ/g,sub:`ui`},{when:function(t){return t.includes(`ouv`)},re:/aʊv/g,sub:`uv`},{when:function(t){return t.endsWith(`eau`)&&t.includes(`ou`)},re:/aʊ/g,sub:`u`},{when:function(t){return t.endsWith(`ou`)&&t!==`you`&&t!==`thou`},re:/aʊ$/,sub:`u`},{when:function(t){return/[bmdvl]our$/.test(t)&&t!==`devour`&&t!==`flour`},re:/aʊɹ$/,sub:`ɝ`},{when:function(t){return t.endsWith(`oussin`)},re:/aʊs/,sub:`us`},{when:function(t){return t.endsWith(`ingham`)&&t.length>=9},re:/həm$/,sub:`hæm`},{when:function(t){return t.endsWith(`tron`)},re:/tɹən$/,sub:`tɹɑn`},{when:function(t){return t.endsWith(`gren`)},re:/ɡɹən$/,sub:`ɡɹɛn`},{when:function(t){return t.endsWith(`craft`)||t.endsWith(`graft`)},re:/ɹ[əʌ]ft$/,sub:`ɹæft`},{when:function(t){return/(?:echt|icht)$/.test(t)},re:/tʃt$/,sub:`kt`},{when:function(t){return t.endsWith(`hagen`)},re:/dʒ([ɛəɪ])n$/,sub:`ɡ$1n`},{when:function(t){return/(?:gerd|gert)$/.test(t)},re:/dʒɝ([dt])$/,sub:`ɡɝ$1`},{when:function(t){return t.startsWith(`kh`)},re:/^kh/,sub:`k`},{when:function(t){return t.startsWith(`dh`)},re:/^dh/,sub:`d`},{when:function(t){return t.startsWith(`orch`)},re:/^ɔɹtʃ/,sub:`ɔɹk`},{when:function(t){return t.includes(`chord`)},re:/tʃ([ɔɑɝ])/,sub:`k$1`},{when:function(t){return t.includes(`anchor`)},re:/tʃ/,sub:`k`},{when:function(t){return t.includes(`och`)&&!t.endsWith(`och`)&&!t.endsWith(`oche`)&&!/och[cfpt]/.test(t)},re:/[ɑɔ]tʃ/g,fn:function(t){return t[0]+`k`}},{when:function(t){return t.endsWith(`och`)&&!t.endsWith(`oach`)&&!t.endsWith(`eoch`)},re:/[ɑɔ]tʃ$/,fn:function(t){return t[0]+`k`}},{when:function(t){return t.includes(`acht`)&&!/(?:macht|nacht|wacht)/.test(t)},re:/[æɑ]tʃt/g,fn:function(t){return t[0]+`kt`}},{when:function(t){return t.includes(`achen`)||t.includes(`achn`)},re:/[æɑ]tʃ([ɛəɪi]n|n)/,fn:function(t,p){return t[0]+`k`+p}},{when:function(t){return/^arch[aeiou]/.test(t)&&!t.startsWith(`archen`)&&!/^arch(?:er|ery|es|ie|ies|ed)$/.test(t)},re:/^ɑɹtʃ/,sub:`ɑɹk`},{when:function(t){return t.endsWith(`chter`)&&t.length>=6},re:/tʃtɝ$/,sub:`ktɝ`},{when:function(t){return t.endsWith(`chner`)&&t.length>=6&&!/tch(?:ner)$/.test(t)},re:/tʃ(?=[nɝ])/,sub:`k`},{when:function(t){return t.length>=7&&/[bcdfghjklmnpqrstvwxyz](?:acher|icher)$/.test(t)&&!/(?:eacher|oocher|picher|spicher)$/.test(t)&&!/^(?:teacher|preacher|bleacher|reacher|poacher|beacher|beecher|breacher)/.test(t)},re:/tʃ(ɝ)$/,sub:`k$1`},{when:function(t){return t.endsWith(`lich`)&&t.length>=6&&!/[auo]lich$/.test(t)},re:/tʃ$/,sub:`k`},{when:function(t){return/(?:achel|ichel|echel)$/.test(t)&&t.length>=6&&!/(?:rachel|michael|machel)$/.test(t)},re:/tʃ([əɛɪ][lɫ]?)$/,sub:`k$1`},{when:function(t){return t.includes(`echt`)&&!/(?:echt|icht)$/.test(t)&&!/echtl|echta/.test(t)},re:/ɛtʃt/g,sub:`ɛkt`},{when:function(t){return t.includes(`ach`)&&!t.endsWith(`ach`)&&!t.endsWith(`ache`)&&!/ach[aeiou]/.test(t)&&/ach[nblrm]/.test(t)&&!t.includes(`tach`)},re:/[æɑ]tʃ(?=[nblrm])/,fn:function(t){return t[0]+`k`}},{when:function(t){return t.includes(`uch`)&&/uch[nblrm]/.test(t)&&!/^(?:much|such|touch|vouch|pouch|couch|ouch|crouch|grouch|slouch)/.test(t)&&!/^(?:bou|gou|lou|tou|vou)ch/.test(t)&&!/uch[aeiou]$/.test(t)},re:/[ʌʊ]tʃ(?=[nblrm])/,fn:function(t){return t[0]+`k`}},{when:function(t){return t.includes(`cchi`)},re:/ktʃ/g,sub:`kk`},{when:function(t){return t.includes(`cchi`)},re:/tʃ/g,sub:`k`},{when:function(t){return/chet(?:ti|ta|to|te)$/.test(t)&&t.length>=6},re:/tʃ/g,sub:`k`},{when:function(t){return/cci[oa]?$/.test(t)},re:/ks([ɪi]?)(oʊ|ə|ʊ|eɪ|a)?$/,sub:`tʃ$1$2`},{when:function(t){return t.includes(`cci`)&&!/cci[oa]?$/.test(t)&&!/ccid|ccip|ccint|ccent/.test(t)},re:/ksɪ([ɑɔɛ])/g,sub:`tʃ$1`},{when:function(t){return t.includes(`cci`)&&!/cci[oa]?$/.test(t)&&/(?:ini|ino|elli|ello|illi|illo|iani|iano)$/.test(t)},re:/ksɪ/g,sub:`tʃɪ`},{when:function(t){return t.includes(`eich`)&&t.length>=5},re:/eɪ/g,sub:`aɪ`},{when:function(t){return t.includes(`eich`)&&t.length>=5},re:/aɪtʃ/g,sub:`aɪk`},{when:function(t){return/th(?:ought|ink|ank)/.test(t)},re:/ð/g,sub:`θ`},{when:function(t){return/psych|tech(?!y)/.test(t)},re:/tʃ/g,sub:`k`},{when:function(t){return/[^aeiouckl]ett?$/.test(t)},re:/ət(s?)$/,sub:`ɪt$1`},{when:function(t){return/[^aeiou]et(t?e?)s$/.test(t)},re:/əts$/,sub:`ɪts`},{when:function(t){return/ec[k]?$/.test(t)},re:/ək$/,sub:`ɪk`},{when:function(t){return/enb[eu]rg/.test(t)},re:/ɪn(?=b)/,sub:`ən`},{when:function(t){return/[sxzcg]es$/.test(t)},re:/([szʃʒ])əs$/,sub:`$1əz`},{when:function(t){return t.endsWith(`s`)&&!t.endsWith(`ss`)},re:/([bdɡvðmnŋɫlɹ])s$/,sub:`$1z`},{when:function(t){return/[aeiouwy]s$/.test(t)&&!/[uia]s$/.test(t)},re:/([aɪʊoeiɔuəɝ])s$/,sub:`$1z`},{when:function(t){return/[^aeiou]u$/.test(t)},re:/ə$/,sub:`u`}],IPA_V=`aeiouɑæɛɪɔʊʌəɝ`,IPA_C=`pbtdkɡfvszʃʒθðmnŋɫlɹhjw`,ONSET_MAX_1_RE=RegExp(`([${IPA_V}])([${IPA_C}])ˈ(?=[${IPA_V}])`,`g`),ONSET_MAX_2_RE=RegExp(`([${IPA_V}])([${IPA_C}])ˈ([${IPA_C}])(?=[${IPA_V}])`,`g`),ONSET_CLUSTERS=new Set([`pɹ`,`tɹ`,`kɹ`,`bɹ`,`dɹ`,`ɡɹ`,`fɹ`,`θɹ`,`ʃɹ`,`pl`,`bl`,`kl`,`ɡl`,`fl`,`pɫ`,`bɫ`,`kɫ`,`ɡɫ`,`fɫ`,`tw`,`kw`,`dw`,`ɡw`,`hw`]);function nucleiBetween(t,p,m){for(var h=0,g=!1,_=p;_<m;_++)IPA_V.includes(t[_])?(g||h++,g=!0):g=!1;return h}function addSecondary(t,p){var m=p.exec(t);if(!m)return t;for(var h=m.index;h>0&&IPA_C.includes(t[h-1]);)h--;if(h===m.index-1&&t[h]===`ɹ`&&h>0&&(t[h-1]===`ɪ`||t[h-1]===`ə`)&&(h=m.index),h>0&&(t[h-1]===`ˌ`||t[h-1]===`ˈ`))return t;var g=t.indexOf(`ˈ`);return g<0||g>h||nucleiBetween(t,g,h)<2?t:t.slice(0,h)+`ˌ`+t.slice(h)}var FULL_NUCLEI=[`eɪ`,`aɪ`,`oʊ`,`aʊ`,`ɔɪ`,`ɑ`,`æ`,`ɔ`,`ɛ`,`u`],LEGAL_ONSET_2=new Set(Array.from(ONSET_CLUSTERS).concat([`sp`,`st`,`sk`,`sm`,`sn`,`sw`,`sl`,`sɫ`,`sf`]));function addFullVowelSecondaries(t){var p=t.indexOf(`ˈ`);if(p<0||t.indexOf(`ˌ`)>=0)return t;for(var m=[],h=0;h<t.length;)if(IPA_V.includes(t[h])){for(var g=h;h<t.length&&IPA_V.includes(t[h]);)h++;m.push([g,h])}else h++;for(var _=-1,v=0;v<m.length;v++)if(m[v][0]>p){_=v;break}if(_<0)return t;for(var y=t,b=0,x=function(p){var h=m[p],g=h[0],_=h[1],v=t.slice(g,_);if(!FULL_NUCLEI.some(function(t){return v.startsWith(t)})||_>=t.length)return`continue`;var x=g;if(x>0&&IPA_C.includes(t[x-1])&&(x>1&&IPA_C.includes(t[x-2])&&LEGAL_ONSET_2.has(t.slice(x-2,x))?x-=2:--x),t[x-1]===`ˈ`||t[x-1]===`ˌ`)return`continue`;y=y.slice(0,x+b)+`ˌ`+y.slice(x+b),b++},v=_+2;v<m.length;v++)x(v);return y}var SECONDARY_SUFFIXES=[[/iz(?:es?|ed|ing|ers?)?$/,/aɪz/],[/at(?:es?|ed|ing)?$/,/eɪt(?!.*eɪt)/],[/ism$/,/ɪzəm$/],[/ory$/,/ɔɹi$/]],ATION_SWAP_RE=/ˈ(.*)ˌeɪʃən$/,LOAN_PENULT_ORTHO_RE=/[^aeiou]i[bdfgklmnpstvz][oai]$/,LOAN_PENULT_RE=RegExp(`ˈ([${IPA_C}]*)ɪ([${IPA_C.replace(`ɹ`,``)}])(oʊ|[əai])\$`);function applyPostStress(t,p){var m=t;if(m.indexOf(`ˈ`)<0)return m;if(m=m.replace(ONSET_MAX_1_RE,function(t,p,m){return m===`ɹ`&&(p===`ɪ`||p===`ə`)?t:p+`ˈ`+m}),m=m.replace(ONSET_MAX_2_RE,function(t,p,m,h){return ONSET_CLUSTERS.has(m+h)?p+`ˈ`+m+h:t}),LOAN_PENULT_ORTHO_RE.test(p)&&(m=m.replace(LOAN_PENULT_RE,`ˈ$1i$2$3`)),p.endsWith(`ation`))m=m.replace(ATION_SWAP_RE,`ˌ$1ˈeɪʃən`);else{for(var h=!1,g=0,_=SECONDARY_SUFFIXES;g<_.length;g++){var v=_[g],y=v[0],b=v[1];if(y.test(p)){m=addSecondary(m,b),h=!0;break}}h||(m=addFullVowelSecondaries(m))}return m}function applyPostLexical(t,p,m){for(var h=t,g=0,_=POST_PROC_RULES;g<_.length;g++){var v=_[g],y=v[0],b=v[1];h=h.replace(y,b)}for(var x=0,S=POST_LEX_RULES;x<S.length;x++){var C=S[x];C.when(p,m)&&(h=C.fn===void 0?h.replace(C.re,C.sub):h.replace(C.re,C.fn))}return h}var VOWELS=new Set([`a`,`e`,`i`,`o`,`u`,`y`]),CONSONANTS=new Set(`bcdfghjklmnpqrstvwxyz`.split(``)),VALID_ONSETS=new Set(`b.bl.br.c.ch.cl.cr.d.dr.dw.f.fl.fr.g.gl.gr.gu.h.j.k.kl.kn.kr.l.m.n.p.ph.pl.pr.ps.q.qu.r.rh.s.sc.sch.scr.sh.sk.sl.sm.sn.sp.sph.spl.spr.st.str.sv.sw.t.th.thr.tr.ts.tw.v.w.wh.wr.x.y.z`.split(`.`)),SUFFIX_RULES=[[/^ge$/,`dʒ`,!1],[/^[cs]e$/,`s`,!1],[/^que$/,`k`,!1],[/^the$/,`ð`,!1],[/^sten$/,`sən`,!1],[/^stion$/,`stʃən`,!1],[/^tion$/,`ʃən`,!1],[/^sion$/,`ʒən`,!1],[/^c[ei]an$/,`ʃən`,!1],[/^lion$/,`ljən`,!1],[/^[ct]ial$/,`ʃəl`,!1],[/^cient$/,`ʃənt`,!1],[/^scien$/,`ʃən`,!1],[/^ture$/,`tʃɝ`,!1],[/^sure$/,`ʒɝ`,!1],[/^g[ei]ous$/,`dʒəs`,!1],[/^[ct]ious$|^scious$|^ceous$/,`ʃəs`,!1],[/^kness$/,`knəs`,!1],[/^ness$/,`nəs`,!1],[/^ment$/,`mənt`,!1],[/^less$/,`ləs`,!1],[/^ful$/,`fəl`,!1],[/^ly$/,`li`,!1],[/^er$/,`ɝ`,!1],[/^ers$/,`ɝz`,!1],[/^est$/,`əst`,!1],[/^ing$/,`ɪŋ`,!1],[/^ed$/,`d`,!1],[/^ves$/,`vz`,!1],[/^e?s$/,`z`,!1],[/^age$/,`ɪdʒ`,!1],[/^ism$/,`ɪzəm`,!1],[/^ist$/,`ɪst`,!1],[/^al$/,`əl`,!1],[/^ic(s?)$/,`ɪk$1`,!0],[/^lity$/,`ləti`,!1],[/^ty$/,`ti`,!1],[/^[ae]ry$/,`ɛri`,!1],[/^ory$/,`ɔri`,!1],[/^y$/,`i`,!1],[/^stein$/,`staɪn`,!1],[/^ford$/,`fɝd`,!1],[/^ward$/,`wɝd`,!1],[/^more$/,`mɔɹ`,!1],[/^b(?:erry|ury)$/,`bɛɹi`,!1],[/^well$/,`wɛl`,!1],[/^back$/,`bæk`,!1],[/^beck$/,`bɛk`,!1],[/^star$/,`stɑɹ`,!1],[/^tel[l]?$/,`tɛl`,!1],[/^te[ck]$/,`tɛk`,!1],[/^cor[e]?$/,`kɔɹ`,!1],[/^sto$/,`stoʊ`,!1],[/^dale$/,`deɪl`,!1],[/^twood$/,`twʊd`,!1],[/^cle$/,`kəɫ`,!1],[/^le$/,`əl`,!1]],PHONEME_RULES=[[/^pn/,`n`],[/^ps/,`s`],[/^pt/,`t`],[/^[kg]n/,`n`],[/^m[bn]$/,`m`],[/^mn/,`n`],[/^wr/,`ɹ`],[/^rh/,`ɹ`],[/^bt$/,`t`],[/^sph/,`sf`],[/^ght/,`t`],[/^gh$/,``],[/^gh/,`ɡ`],[/^lm/,`m`],[/^[oa]ught/,`ɔt`],[/^ough$/,`ʌf`],[/^alm$/,`ɑm`],[/^alk(?=[^aeiou]|$)/,`ɔk`],[/^al$/,`ɔl`],[/^ind$/,`aɪnd`],[/^ild$/,`aɪld`],[/^old$/,`oʊld`],[/^olt$/,`oʊlt`],[/^olk$/,`oʊk`],[/^ost$/,`oʊst`],[/^ould$/,`ʊd`],[/^tsch/,`tʃ`],[/^s(?:ch|z)/,`ʃ`],[/^she$/,`ʃi`],[/^he$/,`hi`],[/^d[zg]/,`dʒ`],[/^cz/,`tʃ`],[/^chr/,`kɹ`],[/^chl/,`kl`],[/^t?ch/,`tʃ`],[/^ck/,`k`],[/^ph/,`f`],[/^sh/,`ʃ`],[/^thr/,`θɹ`],[/^th(?=ink|ing$|ick|orn)/,`θ`],[/^the$/,`ðə`],[/^th(?=[aeiou])/,`ð`],[/^th/,`θ`],[/^wor(?!e)/,`wɝ`],[/^wh(?=o)/,`h`],[/^wh/,`hw`],[/^qu/,`kw`],[/^ng/,`ŋ`],[/^o[ao]r/,`ɔɹ`],[/^ook/,`ʊk`],[/^ood/,`ʊd`],[/^oo/,`u`],[/^ous$/,`əs`],[/^oup/,`up`],[/^ou/,`aʊ`],[/^ow(?=[snmk])/,`aʊ`],[/^ow/,`oʊ`],[/^o[yi]/,`ɔɪ`],[/^a[uw]/,`ɔ`],[/^ay/,`eɪ`],[/^air/,`ɛɹ`],[/^ai/,`eɪ`],[/^eau[x]?/,`oʊ`],[/^ealth/,`ɛlθ`],[/^e[ae]/,`i`],[/^iew/,`ju`],[/^ier$/,`iɝ`],[/^ie/,`i`],[/^cei/,`si`],[/^ei/,`eɪ`],[/^ey$/,`i`],[/^ey/,`eɪ`],[/^ight/,`aɪt`],[/^igh/,`aɪ`],[/^oa/,`oʊ`],[/^oss/,`ɔs`],[/^eur/,`ɝ`],[/^eu/,`ju`],[/^ew/,`u`],[/^ue/,`u`],[/^uil/,`ɪl`],[/^ui/,`u`],[/^are$/,`ɛɹ`],[/^ire$/,`aɪɹ`],[/^ore$/,`ɔɹ`],[/^ure$/,`jʊɹ`],[/^ere$/,`ɪɹ`],[/^ar/,`ɑɹ`],[/^er(?=[aeiouwy])/,`ɛɹ`],[/^[eiu]r/,`ɝ`],[/^or/,`ɔɹ`],[/^c(?=[eiy])/,`s`],[/^giv/,`gɪv`],[/^gif/,`gɪf`],[/^gir/,`gɝ`],[/^gil/,`ɡɪl`],[/^g(?=[eiy])/,`dʒ`],[/^spr/,`spɹ`],[/^str/,`stɹ`],[/^scr/,`skɹ`],[/^spl/,`spl`],[/^squ/,`skw`],[/^bl(?!e$)/,`bl`],[/^br/,`bɹ`],[/^cl/,`kl`],[/^cr/,`kɹ`],[/^dr/,`dɹ`],[/^fl(?!e$)/,`fl`],[/^fr/,`fɹ`],[/^gl(?!e$)/,`ɡl`],[/^gr/,`ɡɹ`],[/^pl(?!e$)/,`pl`],[/^pr/,`pɹ`],[/^sl/,`sl`],[/^sm$/,`zm`],[/^sm/,`sm`],[/^sn/,`sn`],[/^sp/,`sp`],[/^st/,`st`],[/^sw/,`sw`],[/^two/,`tu`],[/^tr/,`tɹ`],[/^tw/,`tw`],[/^tz/,`ts`],[/^b/,`b`],[/^c/,`k`],[/^d/,`d`],[/^f/,`f`],[/^g/,`ɡ`],[/^h/,`h`],[/^j/,`dʒ`],[/^k/,`k`],[/^le$/,`əl`],[/^l/,`l`],[/^m/,`m`],[/^nk/,`ŋk`],[/^ns$/,`nz`],[/^n/,`n`],[/^p/,`p`],[/^r/,`ɹ`],[/^s/,`s`],[/^t/,`t`],[/^v/,`v`],[/^w/,`w`],[/^x(?=[aeiouy])/,`z`],[/^x/,`ks`],[/^ym(?![aeiou])/,`ɪm`],[/^yn(?![aeiou])/,`ɪn`],[/^y$/,`i`],[/^y(?=[aeiou])/,`j`],[/^y(?=[^aeiouy]+$)/,`ɪ`],[/^y/,`aɪ`],[/^z/,`z`],[/^a(?=[^aeioun]y$)/,`eɪ`],[/^a$/,`eɪ`],[/^a/,`æ`],[/^e/,`ɛ`],[/^i$/,`aɪ`],[/^i/,`ɪ`],[/^o$/,`oʊ`],[/^o/,`ɑ`],[/^u$/,`u`],[/^u/,`ʌ`]];function syllabify(t){if(t.length<=3)return[t];for(var p=t.toLowerCase().split(``),m=[],h=``,g=0;g<p.length;){for(var _=g,v=``;g<p.length&&VOWELS.has(p[g]);)v+=p[g],g++;v.length>0&&g<p.length&&p[g]===`w`&&g+1<p.length&&VOWELS.has(p[g+1])&&(v+=p[g],g++);for(var y=``;g<p.length&&CONSONANTS.has(p[g]);)y+=p[g],g++;if(g===_){if(p[g]===`'`||p[g]===`'`||p[g]===`'`){g++;continue}m.length>0&&h.length===0?m[m.length-1]+=p[g]:h+=p[g],g++;continue}if(v)if(y.length===0)h+=v,m.push(h),h=``;else if(y.length===1)h+=v,m.push(h),h=y;else{for(var b=0;b<y.length;){var x=y.substring(b);if(VALID_ONSETS.has(x))break;b++}var S=y.substring(0,b),C=y.substring(b);h+=v+S,m.push(h),h=C}else h+=y}if(h&&m.push(h),m.length>1&&m[m.length-1]===`e`){var w=m.pop();m.length>0&&(m[m.length-1]+=w)}if(m.length>1&&m[m.length-1]===`re`){var T=m[m.length-2];T&&VOWELS.has(T[T.length-1])&&(m.pop(),m[m.length-1]+=`re`)}if(m.length>1&&m[m.length-1]===`le`){var T=m[m.length-2];T&&VOWELS.has(T[T.length-1])&&(m.pop(),m[m.length-1]+=`le`)}for(var E=m.length-1;E>0;E--)m[E].split(``).every(function(t){return CONSONANTS.has(t)})&&m[E-1]&&(m[E-1]+=m[E],m.splice(E,1));return m.filter(function(t){return t&&t.length>0})}function assignStress(t,p){if(t.length<=1)return 0;for(var m=p.toLowerCase(),h=0,g=SUFFIX_RULES;h<g.length;h++){var _=g[h],v=_[0],y=_[2];if(y&&m.match(v))return Math.max(0,t.length-2)}if(m.endsWith(`tion`)||m.endsWith(`sion`)||m.endsWith(`cial`)||m.endsWith(`tial`)||(m.endsWith(`ium`)||m.endsWith(`osis`)||m.endsWith(`itis`)||m.endsWith(`ysis`)||m.endsWith(`iasis`))&&t.length>=2)return Math.max(0,t.length-2);if((m.endsWith(`ance`)||m.endsWith(`ence`))&&t.length>=3)return 1;if(m.endsWith(`ic`)&&t.length>1)return Math.max(0,t.length-2);for(var b=[`ab`,`ad`,`con`,`com`,`de`,`dis`,`ex`,`in`,`mis`,`ob`,`out`,`pre`,`pro`,`re`,`sub`,`un`,`under`],x=0,S=b;x<S.length;x++){var C=S[x];if(!(!m.startsWith(C)||t.length<=2)){var w=m[C.length],T=C[C.length-1];if(w!==T)return 1}}if(t.length===2){for(var E=t[0],D=[`ab`,`ad`,`be`,`con`,`com`,`de`,`dis`,`ex`,`in`,`ob`,`pre`,`pro`,`re`,`sub`,`un`],O=0,k=D;O<k.length;O++){var C=k[O];if(E===C){var w=m[C.length],T=C[C.length-1];if(w===T)break;return 1}}return 0}if(t.length>=3){if(isLikelyCompound(m,t))return 0;var A=t[t.length-2];return isSyllableHeavy(A)?t.length-2:Math.max(0,t.length-3)}return 0}function isSyllableHeavy(t){for(var p=[`aa`,`ai`,`au`,`aw`,`ay`,`ea`,`ee`,`ei`,`eu`,`ey`,`ie`,`oa`,`oo`,`ou`,`ow`,`oy`,`ue`,`ui`],m=0,h=p;m<h.length;m++){var g=h[m];if(t.includes(g))return!0}for(var _=!1,v=0,y=0,b=t;y<b.length;y++){var x=b[y];VOWELS.has(x)?(_=!0,v=0):_&&CONSONANTS.has(x)&&v++}return v>=1}function isLikelyCompound(t,p){if(p.length<2)return!1;var m=[/\w{4,}wide$/,/\w{3,}land$/,/\w{3,}work$/,/\w{3,}time$/,/\w{3,}way$/,/\w{3,}ward$/,/hundred/,/\w{3,}side$/,/\w{3,}where$/,/^over[a-z]{2,}/,/\w{3,}berg$/,/\w{3,}burg$/];return m.some(function(p){return p.test(t)})}function syllableToIPA(t,p,m,h,g,_,v,y){var b,x,S;y===void 0&&(y=!1);var C=(b=_?.length)??0,w=[],T=t;if(T===`le`&&h&&v?.endsWith(`l`))return`l`;if(T===`se`&&h&&v?.match(/[ieo]$/i))return`z`;for(var E=0,D=SUFFIX_RULES;E<D.length;E++){var O=D[E],k=O[0],A=O[1];if(!((k.source===`^le$`||k.source===`^cle$`||k.source===`^twood$`||k.source===`^al$`||k.source===`^que$`||k.source===`^sten$`||k.source===`^[cs]e$`||k.source===`^ge$`)&&!h)&&!(k.source===`^sto$`&&g!==`ne`)&&!((k.source===`^lion$`||k.source===`^scien$`||k.source===`^ford$`||k.source===`^ward$`)&&p===0)&&!(k.source===`^the$`&&(p===0||!h))&&T.match(k))return _?.push({grapheme:T,phoneme:A,rule:`suffix:${k.source}`}),A}var j=/ll/i.test(t),M=/[aeiou]/i.test(t.replace(/y$/i,``)),N=/([b-df-hj-np-tv-z])\1y$/i.test(t);T=T.replace(/([b-df-hj-np-tv-z])\1/g,`$1`);var P=h&&t.length>1&&t.endsWith(`e`)&&!t.endsWith(`ee`)&&!/[^aeiou]le$/.test(t)&&!t.endsWith(`he`)&&!t.endsWith(`tte`)&&!t.endsWith(`ght`)&&!t.endsWith(`se`)&&!t.endsWith(`are`)&&!t.endsWith(`ere`)&&!t.endsWith(`ire`)&&!t.end