-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
186 additions
and
137 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
*.log | ||
node_modules/ | ||
yarn.lock |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
language: node_js | ||
node_js: | ||
- lts/dubnium | ||
- node |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
const fs = require('fs') | ||
var fs = require('fs') | ||
var words = {} | ||
|
||
fs.readFileSync('cmudict-0.7b.txt', 'utf8') | ||
String(fs.readFileSync('cmudict-0.7b.txt')) | ||
.split('\n') | ||
// .slice(0,150) | ||
.filter(function (line) { | ||
.filter(function(line) { | ||
return line.charAt(0).match(/[a-z]/i) | ||
}) | ||
.forEach(function (line) { | ||
// var [a,b] = line.split(" ") | ||
.forEach(function(line) { | ||
var parts = line.split(' ') | ||
|
||
if (parts.length === 2) { | ||
var word = parts[0].toLowerCase() | ||
var transcription = parts[1] | ||
words[word] = transcription | ||
words[parts[0].toLowerCase()] = parts[1] | ||
} | ||
}) | ||
|
||
process.stdout.write(JSON.stringify(words, null, 2)) | ||
fs.writeFileSync('index.json', JSON.stringify(words, null, 2) + '\n') |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ISC License | ||
|
||
Copyright (c) 2015 Zeke Sikelianos <zeke@sikelianos.com> | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# `cmu-pronouncing-dictionary` | ||
|
||
[![Build][build-badge]][build] | ||
[![Downloads][downloads-badge]][downloads] | ||
[![Size][size-badge]][size] | ||
|
||
The 134,000+ words and their pronunciations in the CMU pronouncing dictionary. | ||
|
||
> The CMU Pronouncing Dictionary (also known as cmudict) is a public domain | ||
> pronouncing dictionary created by Carnegie Mellon University (CMU). | ||
> It defines a mapping from English words to their North American | ||
> pronunciations, and is commonly used in speech processing applications. | ||
## Install | ||
|
||
[npm][]: | ||
|
||
```sh | ||
npm install cmu-pronouncing-dictionary | ||
``` | ||
|
||
## Use | ||
|
||
```js | ||
var cmu = require('cmu-pronouncing-dictionary') | ||
|
||
console.log(cmu) | ||
``` | ||
|
||
Yields: | ||
|
||
```js | ||
{ | ||
a: 'AH0', | ||
'a(1)': 'EY1', | ||
"a's": 'EY1 Z', | ||
'a.': 'EY1', | ||
"a.'s": 'EY1 Z', | ||
'a.s': 'EY1 Z', | ||
a42128: 'EY1 F AO1 R T UW1 W AH1 N T UW1 EY1 T', | ||
aa: 'EY2 EY1', | ||
aaa: 'T R IH2 P AH0 L EY1', | ||
aaberg: 'AA1 B ER0 G', | ||
aachen: 'AA1 K AH0 N', | ||
aachener: 'AA1 K AH0 N ER0', | ||
aah: 'AA1', | ||
aaker: 'AA1 K ER0', | ||
aaliyah: 'AA2 L IY1 AA2', | ||
aalseth: 'AA1 L S EH0 TH', | ||
aamodt: 'AA1 M AH0 T', | ||
aancor: 'AA1 N K AO2 R', | ||
// …and many more | ||
} | ||
``` | ||
|
||
## API | ||
|
||
### `cmuPronouncingDictionary` | ||
|
||
`Object.<string>` — Map of English words to [ARPABET][] phonetic transcription | ||
codes. | ||
|
||
## License | ||
|
||
[ISC][license] © [Zeke Sikelianos][author] | ||
|
||
<!-- Definition --> | ||
|
||
[build-badge]: https://img.shields.io/travis/words/cmu-pronouncing-dictionary.svg | ||
|
||
[build]: https://travis-ci.org/words/cmu-pronouncing-dictionary | ||
|
||
[downloads-badge]: https://img.shields.io/npm/dm/cmu-pronouncing-dictionary.svg | ||
|
||
[downloads]: https://www.npmjs.com/package/cmu-pronouncing-dictionary | ||
|
||
[size-badge]: https://img.shields.io/bundlephobia/minzip/cmu-pronouncing-dictionary.svg | ||
|
||
[size]: https://bundlephobia.com/result?p=cmu-pronouncing-dictionary | ||
|
||
[npm]: https://docs.npmjs.com/cli/install | ||
|
||
[license]: license | ||
|
||
[author]: http://zeke.sikelianos.com | ||
|
||
[arpabet]: https://en.wikipedia.org/wiki/ARPABET |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var test = require('tape') | ||
var cmu = require('.') | ||
|
||
test('cmu-pronouncing-dictionary', function(t) { | ||
t.ok(typeof cmu === 'object', 'should be an object') | ||
|
||
t.ok(typeof cmu.fun === 'string', 'there should be a fun,') | ||
t.ok(typeof cmu.perilous === 'string', 'perilous,') | ||
t.ok(typeof cmu.monkey === 'string', 'monkey.') | ||
t.equal(cmu.bought, 'B AA1 T', 'should have arpabet transcriptions') | ||
t.ok(Object.keys(cmu).length > 130000, 'should have loads of words') | ||
|
||
t.end() | ||
}) |
This file was deleted.
Oops, something went wrong.