This commit is contained in:
Alex Yatskov 2016-03-22 21:47:56 -07:00
parent a3189b4ca4
commit a9c92bdfbf

View File

@ -48,26 +48,21 @@ class Deinflection {
} }
for (const [rule, variants] of rules) { for (const [rule, variants] of rules) {
for (const variant of variants) { for (const v of variants) {
const tagsIn = variant.tagsIn;
const tagsOut = variant.tagsOut;
const kanaIn = variant.kanaIn;
const kanaOut = variant.kanaOut;
let allowed = this.tags.length === 0; let allowed = this.tags.length === 0;
for (const tag in this.tags) { for (const tag in this.tags) {
if (this.searchTags(tag, tagsIn)) { if (this.searchTags(tag, v.tagsIn)) {
allowed = true; allowed = true;
break; break;
} }
} }
if (!allowed || !this.term.endsWith(kanaIn)) { if (!allowed || !this.term.endsWith(v.kanaIn)) {
continue; continue;
} }
const term = self.term.slice(0, -kanaIn.length) + kanaOut; const term = self.term.slice(0, -v.kanaIn.length) + v.kanaOut;
const child = new Deinflection(term, tagsOut, rule); const child = new Deinflection(term, v.tagsOut, rule);
if (child.deinflect(validator, rules)) { if (child.deinflect(validator, rules)) {
this.children.append(child); this.children.append(child);
} }