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) {
|
||||
"compile"
|
||||
var ci = w.charCodeAt(0)-97;
|
||||
var f = letterIdx[ci].indexOf(w);
|
||||
if (f>=0 && letterIdx[ci][f+w.length]=="\n") return true;
|
||||
if (letterIdx[ci].substr(0, w.length)==w) return true;
|
||||
var f = letterIdx[ci].indexOf("\n"+w+"\n");
|
||||
if (f>=0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -47,6 +48,7 @@ function checkWord (w) {
|
|||
if (foundWords.indexOf(w)>=0) return false; // already found
|
||||
if (findWord(w)) {
|
||||
foundWords.push(w);
|
||||
foundWords.sort();
|
||||
if (w.length==4) score++;
|
||||
else score += w.length;
|
||||
if (isPangram(w)) score += 7;
|
||||
|
|
Loading…
Reference in New Issue