Skip to content

Commit

Permalink
any word with a number in it gets a zero
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkberry committed Jul 23, 2017
1 parent cd55de0 commit 1bd8287
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pronounceable.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var triples = JSON.parse(
// Remove any non-alphabet characters

This comment has been minimized.

Copy link
@lukem512

lukem512 Jul 24, 2017

This has now become "remove any non-alphanumeric characters"

// and convert to lower case.
function clean(word) {
return word.replace(/[^a-zA-Z]/g, "").toLowerCase();
return word.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
}

// Make a percentage.
Expand All @@ -29,6 +29,8 @@ function percent(score, count) {
function undef(w, i, depth, probs) {
if (depth <= 1) return typeof probs[w[i]] === "undefined";
if (typeof probs[w[i]] === "undefined") return true;
var nums = '0123456789';
if (nums.indexOf(w[i]) !== -1) return true;
return undef(w, i + 1, depth - 1, probs[w[i]]);
}

Expand Down

0 comments on commit 1bd8287

Please sign in to comment.