aboutsummaryrefslogtreecommitdiff
path: root/ext/jp/deinflector.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-03-23 18:12:33 -0700
committerAlex Yatskov <alex@foosoft.net>2016-03-23 18:12:33 -0700
commitc30837065889d4fc4d2984b14b365cc276c79214 (patch)
treeff0b620b6ef146828be43737aa79cc6c80b9a563 /ext/jp/deinflector.js
parenta9c92bdfbf32a96210cf676124d855880f3309e2 (diff)
Fixes to make deinflection work
Diffstat (limited to 'ext/jp/deinflector.js')
-rw-r--r--ext/jp/deinflector.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/jp/deinflector.js b/ext/jp/deinflector.js
index 0bc1c442..3dd233eb 100644
--- a/ext/jp/deinflector.js
+++ b/ext/jp/deinflector.js
@@ -47,7 +47,8 @@ class Deinflection {
this.children.push(child);
}
- for (const [rule, variants] of rules) {
+ for (const rule in rules) {
+ const variants = rules[rule];
for (const v of variants) {
let allowed = this.tags.length === 0;
for (const tag in this.tags) {
@@ -61,10 +62,10 @@ class Deinflection {
continue;
}
- const term = self.term.slice(0, -v.kanaIn.length) + v.kanaOut;
+ const term = this.term.slice(0, -v.kanaIn.length) + v.kanaOut;
const child = new Deinflection(term, v.tagsOut, rule);
if (child.deinflect(validator, rules)) {
- this.children.append(child);
+ this.children.push(child);
}
}
}
@@ -89,9 +90,9 @@ class Deinflection {
const paths = [];
for (const child of this.children) {
- for (const path in child.gather()) {
+ for (const path of child.gather()) {
if (this.rule.length > 0) {
- path.rules.append(this.rule);
+ path.rules.push(this.rule);
}
path.source = this.term;