Pronouncingjs
a simple javascript interface to the CMU pronouncing dictionary (for node and browser!)
Install / Use
/learn @aparrish/PronouncingjsREADME
pronouncing-js
A simple interface to the CMU Pronouncing Dictionary. By Allison Parrish.
This module is a work in progress (obviously).
Installation
$ npm install aparrish/pronouncingjs
Or if you're using the browserified version, download pronouncing-browser.js
from the build directory and include it using a <script> tag:
<script src="pronouncing-browser.js"></script>
Usage
This library has feature parity with
the Pronouncing Python module.
All of the examples in the Tutorial and
Cookbook for
the Python module also work in Javascript, though the functions in
pronouncing.js use camelCase instead of underscores (e.g., Python's
search_stresses becomes searchStresses in Javascript).
Use the module in Node like so:
> var pronouncing = require('pronouncing');
undefined
> pronouncing.phonesForWord("adverse")
[ 'AE0 D V ER1 S', 'AE1 D V ER2 S', 'AE2 D V ER1 S' ]
> pronouncing.syllableCount(pronouncing.phonesForWord("adverse")[0])
2
> pronouncing.rhymes("sinking")
[ 'blinking',
'drinking',
'linking',
'plinking',
'rethinking',
'shrinking',
'stinking',
'thinking',
'unthinking',
'winking' ]
> pronouncing.search("^S K R AE1")
[ 'scrabble',
'scragg',
'scraggle',
'scraggly',
... output omitted for brevity ...
'scraps',
'scratching',
'scratchy',
'skramstad' ]
> pronouncing.stresses(pronouncing.phonesForWord("snappiest")[0])
'102'
> pronouncing.searchStresses("^00[12]00[12]$")
[ 'neopositivist', 'undercapitalize', 'undercapitalized' ]
A browserified version of the library is in build. Check demo/index.html
for an example of how it works!
License
Code in this module is distributed under an MIT license. The CMU pronouncing dictionary itself is included with this module, but has its own license; check the CMU Pronouncing Dictionary page for more information.
Acknowledgements
This package was originally developed as part of my Spring 2015 research fellowship at ITP. Thank you to the program and its students for their interest and support!
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
