compromise-speech
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published
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.

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')

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, which is a simple rule-based pronounciation system.

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')

let doc = nlp('edmonton oilers')
doc.compute('soundsLike')
doc.json()
/*[{
  "terms": [
    {
      "normal": "edmonton",
      "soundsLike": "etmonton"
    },
    {
      "normal": "oilers",
      "soundsLike": "oilers"
    }
  ]
}]
*/

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i compromise-speech

Weekly Downloads

775

Version

0.1.1

License

MIT

Unpacked Size

32.1 kB

Total Files

15

Last publish

Collaborators

  • spencermountain