This commit is contained in:
Alex Yatskov 2016-09-10 22:25:16 -07:00
parent 0587399883
commit 3ec57d5bf6
2 changed files with 9 additions and 3 deletions

View File

@ -59,12 +59,18 @@ class Translator {
const promises = [];
for (let i = text.length; i > 0; --i) {
promises.append(
promises.push(
this.deinflector.deinflect(text.slice(0, i), term => {
return this.dictionary.findTerm(term).then(definitions => definitions.map(def => def.tags));
}).then(inflects => {
for (const inflect of inflects) {
this.processTerm(groups, df.source, df.tags, df.rules, df.root);
this.processTerm(
groups,
inflect.source,
inflect.tags,
inflect.rules,
inflect.root
);
}
})
);

View File

@ -297,7 +297,7 @@ class Yomichan {
}
api_findTerm({text, callback}) {
callback(this.translator.findTerm(text));
this.translator.findTerm(text).then((result) => callback(result));
}
api_getDeckNames({callback}) {