npm.io
0.0.6 • Published 5 years ago

compromise-syllables

Licence
MIT
Version
0.0.6
Deps
0
Size
41 kB
Vulns
0
Weekly
0
Stars
12.2K
a plugin for compromise

This is a naive syllable tokenizer, and simply splits a compromise document, according to some simple, biased interpretation.

It makes some judgement-calls about pronunciation, but also where splits make the most sense.

npm install compromise-syllables

Demo

const nlp = require('compromise')
nlp.extend(require('compromise-syllables'))

let doc = nlp('Chocolate microscopes?')
doc.terms().syllables()
/*[
  {text:'Chocolate', syllables:['cho', 'co', 'late']},
  {text:'microscopes?', syllables:['mic', 'ro', 'scope']}
]*/

.syllables( {options} ) will pass it's optional first parameter to .json(). You can see the full set of options here.

Keep in mind there are cultural-differences in syllable pronunciation, which this library has a certain bias.

MIT