pronounciation metadata plugin for compromise
npm install compromise-speech
### Syllables Tokenize a word approximately by it's pronounced syllables. We use a custom rule-based alortithm for this. ```js import plg from 'compromise-speech' nlp.extend(plg) let doc = nlp('seventh millenium. white collar') doc.syllables() [ [ 'se', 'venth', 'mil', 'le', 'nium' ], [ 'white', 'col', 'lar' ] ] ``` Alternatively, if you'd like to combine syllable information with other properties, you can use `.compute('syllables')` ```js let doc = nlp('edmonton oilers') doc.compute('syllables') doc.json() /*[{ "terms": [ { "normal": "edmonton", "syllables": ["ed", "mon", "ton"] }, { "normal": "oilers", "syllables": ["oi", "lers"] } ] }] */ ``` ### SoundsLike Generate an expected pronounciation for the word, as a normalized string. We use the [metaphone implementation](https://en.wikipedia.org/wiki/Metaphone), which is a simple rule-based pronounciation system. ```js import plg from 'compromise-speech' nlp.extend(plg) let doc = nlp('seventh millenium. white collar') doc.soundsLike() // [ [ 'sefenth', 'milenium' ], [ 'wite', 'kolar' ] ] ``` Alternatively, if you'd like to combine syllable information with other properties, you can use `.compute('syllables')` ```js let doc = nlp('edmonton oilers') doc.compute('soundsLike') doc.json() /*[{ "terms": [ { "normal": "edmonton", "soundsLike": "etmonton" }, { "normal": "oilers", "soundsLike": "oilers" } ] }] */ ``` MIT