mirror of https://github.com/espruino/BangleApps
Correctly check word boundarie in dictionaries look ups; fix bug in index regeneration.
parent
96d7731256
commit
10589f0dc8
|
@ -0,0 +1,2 @@
|
||||||
|
0.01: New app!
|
||||||
|
0.02: Fix bug with regenerating index, fix bug in word lookups
|
|
@ -31,8 +31,9 @@ function prepareLetterIdx () {
|
||||||
function findWord (w) {
|
function findWord (w) {
|
||||||
"compile"
|
"compile"
|
||||||
var ci = w.charCodeAt(0)-97;
|
var ci = w.charCodeAt(0)-97;
|
||||||
var f = letterIdx[ci].indexOf(w);
|
if (letterIdx[ci].substr(0, w.length)==w) return true;
|
||||||
if (f>=0 && letterIdx[ci][f+w.length]=="\n") return true;
|
var f = letterIdx[ci].indexOf("\n"+w+"\n");
|
||||||
|
if (f>=0) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ function checkWord (w) {
|
||||||
if (foundWords.indexOf(w)>=0) return false; // already found
|
if (foundWords.indexOf(w)>=0) return false; // already found
|
||||||
if (findWord(w)) {
|
if (findWord(w)) {
|
||||||
foundWords.push(w);
|
foundWords.push(w);
|
||||||
|
foundWords.sort();
|
||||||
if (w.length==4) score++;
|
if (w.length==4) score++;
|
||||||
else score += w.length;
|
else score += w.length;
|
||||||
if (isPangram(w)) score += 7;
|
if (isPangram(w)) score += 7;
|
||||||
|
|
Loading…
Reference in New Issue