aboutsummaryrefslogtreecommitdiff
path: root/ext/jp/translator.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-03-22 20:02:41 -0700
committerAlex Yatskov <alex@foosoft.net>2016-03-22 20:02:41 -0700
commit495c12b6c27968837c135902b4446c3bba958590 (patch)
treef81a7698341d34edb17373cb6ff6f8728bf73ffb /ext/jp/translator.js
parentf6342da49da58b966275c7fde699ce38f5d68b0b (diff)
Maybe this works
Diffstat (limited to 'ext/jp/translator.js')
-rw-r--r--ext/jp/translator.js39
1 files changed, 9 insertions, 30 deletions
diff --git a/ext/jp/translator.js b/ext/jp/translator.js
index a071a768..c45d7174 100644
--- a/ext/jp/translator.js
+++ b/ext/jp/translator.js
@@ -64,7 +64,7 @@ class Translator {
}
}
- const results = formatResults(groups).sort(resultSorter);
+ const results = groups.sort(resultSorter);
let length = 0;
for (const result of results) {
@@ -90,37 +90,16 @@ class Translator {
}
processTerm(groups, source, rules=[], root='') {
- root = root || source;
-
- // for (const entry of this.dictionary.findTerm(root)) {
- // const key =
- // }
-
- // root = root or source
-
- // for entry in self.dictionary.findTerm(root, wildcards):
- // key = entry['expression'], entry['reading'], entry['glossary']
- // if key not in groups:
- // groups[key] = entry['tags'], source, rules
- }
-
- formatResult(group) {
- const results = [];
- for (const [key, value] of groups) {
- [expression, reading, glossary] = key;
- [tags, source, rules] = group;
-
- results.push({
- expression: expression,
- reading: reading,
- glossary: glossary,
- rules: rules,
+ for (const entry of this.dictionary.findTerm(root || source)) {
+ groups[entry.id] = {
+ expression: entry.expression,
+ reading: entry.reading,
+ glossary: entry.glossary,
+ tags: entry.tags,
source: source,
- tags: tags
- });
+ rules: rules
+ };
}
-
- return results;
}
resultSorter(v1, v2) {