summaryrefslogtreecommitdiff
path: root/ext/jp/deinflector.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-03-20 18:27:11 -0700
committerAlex Yatskov <alex@foosoft.net>2016-03-20 18:27:11 -0700
commitc242e49c7f10943c2a9515e8b60f0b675a992573 (patch)
treedd7490b2f10bd8251c32678dc93f82c2508e1dfe /ext/jp/deinflector.js
parent2d526b7ecd365d1a3eb93326ceb04c13c78bb2a3 (diff)
Cleanup
Diffstat (limited to 'ext/jp/deinflector.js')
-rw-r--r--ext/jp/deinflector.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/ext/jp/deinflector.js b/ext/jp/deinflector.js
index e93da29e..e4457507 100644
--- a/ext/jp/deinflector.js
+++ b/ext/jp/deinflector.js
@@ -23,7 +23,6 @@ class Deinflection {
this.term = term;
this.tags = tags;
this.rule = rule;
- this.success = false;
}
validate(validator) {
@@ -63,17 +62,15 @@ class Deinflection {
}
}
- // FIX
- // if (!allowed || !this.term.endswith(kanaIn)) {
- // continue;
- // }
-
- // FIX
- // const term = self.term[:-kanaIn.length] + kanaOut;
- // const child = new Deinflection(term, tagsOut, rule);
- // if (child.deinflect(validator, rules)) {
- // this.children.append(child);
- // }
+ if (!allowed || !this.term.endsWith(kanaIn)) {
+ continue;
+ }
+
+ const term = self.term.slice(0, -kanaIn.length) + kanaOut;
+ const child = new Deinflection(term, tagsOut, rule);
+ if (child.deinflect(validator, rules)) {
+ this.children.append(child);
+ }
}
}
@@ -82,8 +79,7 @@ class Deinflection {
searchTags(tag, tags) {
for (const t of tags) {
- // FIX
- if (re.search(tag, t)) {
+ if (tag === t) {
return true;
}
}
@@ -123,7 +119,7 @@ class Deinflector {
}
deinflect(term, validator) {
- const node = new Deinflection(term)
+ const node = new Deinflection(term);
if (node.deinflect(validator, this.rules)) {
return node.gather();
}