Skip to content

Commit

Permalink
unknown words
Browse files Browse the repository at this point in the history
  • Loading branch information
minorua committed Feb 10, 2024
1 parent 212f0f5 commit d154719
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ function loadFiles(files) {
});
}
result = result.then(() => {
console.log("Unknown words:");
console.log(token);

let words = [];
for (let k of Object.keys(token).sort()) {
words.push("<div>" + k.replace("<", "&lt;").replace(">", "&gt") + ": " + token[k] + "</div>");
}
addListItem("<li>" + words.join("") + "</li>");

setStatusText("Completed!", 2000);
});
}
Expand Down Expand Up @@ -267,6 +276,15 @@ function checkTranslation(s, t, lang) {
if (tokenizer) {

var path = tokenizer.tokenize(t);
var w;
for (let t of path) {
w = t.surface_form;
if (isNaN(w) && t.word_type == "UNKNOWN") {
if (t.indexOf(w) == -1) {
token[w] = (token[w] === undefined) ? 1 : token[w] + 1;
}
}
}
console.log(path);

}
Expand Down

0 comments on commit d154719

Please sign in to comment.