summaryrefslogtreecommitdiff
path: root/ext/jp
diff options
context:
space:
mode:
Diffstat (limited to 'ext/jp')
-rw-r--r--ext/jp/translator.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/ext/jp/translator.js b/ext/jp/translator.js
index c45d7174..542871a9 100644
--- a/ext/jp/translator.js
+++ b/ext/jp/translator.js
@@ -55,7 +55,15 @@ class Translator {
for (let i = text.length; i >= 0; --i) {
const term = text.slice(0, i);
- const dfs = this.deinflector.deinflect(term, this.validator);
+ const dfs = this.deinflector.deinflect(term, t => {
+ const tags = [];
+ for (const d of this.dictionary.findTerm(t)) {
+ tags.push(d.tags);
+ }
+
+ return tags;
+ });
+
if (dfs === null) {
this.processTerm(groups, term);
} else {
@@ -132,15 +140,6 @@ class Translator {
return 0;
}
-
- validator(term) {
- const tags = [];
- for (const d of self.dictionary.findTerm(term)) {
- tags.push(d.tags);
- }
-
- return tags;
- }
}
const trans = new Translator();
@@ -151,6 +150,5 @@ trans.initialize({
enamdict: 'jp/data/enamdict.json',
kanjidic: 'jp/data/kanjidic.json'
}, function() {
- // alert('Loaded');
- // alert(trans.dictionary.findTerm('猫'));
+ console.log(trans.findTerm('食べました'));
});