Code Monkey home page Code Monkey logo

node-cmudict's Introduction

node-cmudict

cmudict is a basic wrapper around the CMU Pronouncing Dictonary. The purpose of this wrapper is to enable phoneme extraction from a given word to do linguistic operations such as syllable counting and rhyming. Note that the dictionary is finite: though large, it will not find certain words. In this case you will have to improvise.

Usage

var CMUDict = require('cmudict').CMUDict;
var cmudict = new CMUDict();
var phoneme_str = cmudict.get('prosaic'); // 'P R OW0 Z EY1 IH0 K'

Counting syllables and determining the end rhyme is an exercise left up to the reader as there are a number of ways to do this. (see: Word Hy-phen-a-tion by Com-put-er).

Installation

npm install cmudict

Performance

The dictionary is a huge flatfile. It is lazily read into memory upon the first call to .get(). It takes about 1 second, on average, to read this file in, but from that point on accesses are a simple object property lookup. I originally used node-mmap but found the performance of fs.readFileSync() to be comparable.

Attribution

The nodejs code was written by Nathaniel K Smith [email protected]. The CMU Pronouncing Dictionary is Copyright (C) 1993-2008 by Carnegie Mellon University.

License

All code not under copyright by CMU is licensed under a Creative Commons Attribution-ShareAlike 3.0.

node-cmudict's People

Contributors

vilmibm avatar boodoo avatar raynos avatar

Watchers

James Cloos avatar Abdalla Hassan Awale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.