Skip to content

Commit

Permalink
Remove to-words library
Browse files Browse the repository at this point in the history
Was only being used in cmu-reciter, and was not that comprehensive.
Might add a better solution via a preprocessing step later.
  • Loading branch information
ozaner committed Oct 22, 2024
1 parent 47c0c34 commit af93e42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"imports": {
"@std/log": "jsr:@std/log",
"to-words": "npm:to-words@^4.1.0",
"@stdlib/datasets-cmudict": "https://cdn.jsdelivr.net/gh/stdlib-js/datasets-cmudict@deno/mod.js"
}
}
16 changes: 4 additions & 12 deletions src/reciter/cmu-reciter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { TextToPhonemes } from "./reciter.js";
import { ToWords } from "to-words";
import cmudict from "@stdlib/datasets-cmudict";
const cmudict_val = cmudict();

Expand Down Expand Up @@ -36,17 +35,10 @@ export function TextToPhonemesCMU(words) {
// check cmudict
const proc = getParameterCaseInsensitive(cmudict_val.dict, word);
if (proc === undefined) {
// if its a number
if (isNumeric(word)) {
// parse to words and try again
const toWords = new ToWords();
out.push(TextToPhonemesCMU(toWords.convert(parseFloat(word))));
} else {
// if not found, use classic mode/let sam guess
const res = TextToPhonemes(word);
if (typeof res === "string") {
out.push(res);
}
// if not found, use classic mode/let sam guess
const res = TextToPhonemes(word);
if (typeof res === "string") {
out.push(res);
}
} else {
// if it is found
Expand Down

0 comments on commit af93e42

Please sign in to comment.