summaryrefslogtreecommitdiff
path: root/ext/jp
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-03-22 21:47:56 -0700
committerAlex Yatskov <alex@foosoft.net>2016-03-22 21:47:56 -0700
commita9c92bdfbf32a96210cf676124d855880f3309e2 (patch)
tree6d3010c6f2a73e8f46d252097b5e96e8e49f714e /ext/jp
parenta3189b4ca44572df9d6038d8ac6d97262e0ba0f0 (diff)
WIP
Diffstat (limited to 'ext/jp')
-rw-r--r--ext/jp/deinflector.js15
1 files changed, 5 insertions, 10 deletions
diff --git a/ext/jp/deinflector.js b/ext/jp/deinflector.js
index e4457507..0bc1c442 100644
--- a/ext/jp/deinflector.js
+++ b/ext/jp/deinflector.js
@@ -48,26 +48,21 @@ class Deinflection {
}
for (const [rule, variants] of rules) {
- for (const variant of variants) {
- const tagsIn = variant.tagsIn;
- const tagsOut = variant.tagsOut;
- const kanaIn = variant.kanaIn;
- const kanaOut = variant.kanaOut;
-
+ for (const v of variants) {
let allowed = this.tags.length === 0;
for (const tag in this.tags) {
- if (this.searchTags(tag, tagsIn)) {
+ if (this.searchTags(tag, v.tagsIn)) {
allowed = true;
break;
}
}
- if (!allowed || !this.term.endsWith(kanaIn)) {
+ if (!allowed || !this.term.endsWith(v.kanaIn)) {
continue;
}
- const term = self.term.slice(0, -kanaIn.length) + kanaOut;
- const child = new Deinflection(term, tagsOut, rule);
+ const term = self.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);
}