Created
April 17, 2015 22:20
-
-
Save aparrish/78c23721aeb0e8784615 to your computer and use it in GitHub Desktop.
words beginning with fleh, a node example for parsing the CMU pronouncing dictionary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var dictionary = fs.readFileSync("cmudict-0.7b", {encoding: 'utf8'}); | |
var lines = dictionary.split("\n"); | |
for (var i = 0; i < lines.length; i++) { | |
var line = lines[i]; | |
if (/^;/.test(line)) { continue; } | |
if (line.length == 0) { continue; } | |
var parts = line.split(" "); | |
var word = parts[0]; | |
var phones = parts[1]; | |
if (/^F L EH/.test(phones)) { | |
console.log(line); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment