Built-In Namespace _global_
| Method Attributes | Method Name and Description |
|---|---|
|
cmudictToArray(fileName)
Reads the cmudict file into a JavaScript array of arrays.
|
|
|
cmudictToSqliteDb(fileName)
Parses the cmudict file into an SQLite database.
|
Method Detail
{Array}
cmudictToArray(fileName)
Reads the cmudict file into a JavaScript array of arrays.
Defined in: <src/cmudict-to-sqlite.js>.
Author: Matthew Kastor.
Defined in: <src/cmudict-to-sqlite.js>.
Author: Matthew Kastor.
// Reading the CMU Pronouncing Dictionary from the flat file `cmudict` into
// a JavaScript array:
var cmu = require('cmudict-to-sqlite');
var fileName = 'cmudict.0.7a';
var cmudict = cmu.cmudictToArray(fileName);
// the array will be huge and on my machine it takes longer to display it to
// the console than it does to parse the file so, let's just display the first
// thirty records
var count = 30;
while (count > 0) {
console.log(cmudict[count]);
count -= 1;
}
- Parameters:
- {String} fileName
- The name and location of the cmudict to parse.
- Returns:
- {Array} An array of arrays. Each element in the array is an array with item 0 being the word and item 1 being the ARPAbet code. The array will also have a license property which contains the license header from the given cmudict file.
- Requires:
- fs
cmudictToSqliteDb(fileName)
Parses the cmudict file into an SQLite database.
Defined in: <src/cmudict-to-sqlite.js>.
Author: Matthew Kastor.
Defined in: <src/cmudict-to-sqlite.js>.
Author: Matthew Kastor.
// Converting the CMU Pronouncing Dictionary from the flat file `cmudict` into
// an sqlite database:
var cmu = require('cmudict-to-sqlite');
var fileName = 'cmudict.0.7a';
cmu.cmudictToSqliteDb(fileName);
- Parameters:
- {String} fileName
- The name and location of the cmudict to parse.
- Requires:
- sqlite3
- cmudictToArray
- See:
- Carnegie Mellon University's information and download links for cmudict
- Wikipedia's article on the CMU Pronouncing Dictionary
- Wikipedia's ARPAbet article