0.0.9 • Published 9 years ago

cmusphinxdict v0.0.9

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

CMUSphinxDict

Wrapper for CMU Sphinx Pronouncing Dictionary. It's a hashtable that maps words to phonemes.

Install

npm install cmusphinxdict

Usage

Single word

CMUSphinxDict.get('hello', function(word, pronouncings) {
  console.log(word); // 'HELLO'
  console.log(pronouncings); // ['HH AH L OW', 'HH EH L OW']
});

Multiple words

CMUSphinxDict.get(['hello', 'world'], function(words, pronouncings) {
  console.log(words); // ['HELLO', 'WORLD']
  console.log(pronouncings); // [['HH AH L OW', 'HH EH L OW'], ['W ER L D']]
});

Special character lookup

CMUSphinxDict.get('.', function(word, pronouncings) {
  console.log(word); // '.'
  console.log(pronouncings); // [ 'D EH S AH M AH L', 'D AA T', 'P IH R IY AH D', 'P OY N T' ]
});

Add additional pronouncings

additionalPronouncings.json

[
  {
    "AMALTHEA": [
      "AH M AA L TH IY AH"
    ]
  }
]
var file = fs.createReadStream(__dirname + '/additionalPronouncings.json');

CMUSphinxDict.addPronouncings(file, function(error, words, pronouncings) {
  console.log(words); // ['AMALTHEA']
  console.log(pronouncings); // [['AH M AA L TH IY AH']]
});

Command line

$ cmusphinxdict hello world

HELLO HH AH L OW
HELLO(2) HH EH L OW
WORLD W ER L D

JSON format:

$ cmusphinxdict hello world --format=json

{
  "HELLO": [
    "HH AH L OW",
    "HH EH L OW"
  ],
  "WORLD": [
    "W ER L D"
  ]
}

Aliases for format: -f=[type], --format=[type], --json

Format types: json, text (default)

License

CMU Pronouncing Dictionary is release under the Public Domain.

Everything else is released under the MIT License.

0.0.9

9 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago