From 92e62c798d750766fe6631cc4b1e9d67efe788f6 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 1 Apr 2016 22:13:37 -0700 Subject: WIP --- ext/bg/dictionary.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'ext/bg/dictionary.js') diff --git a/ext/bg/dictionary.js b/ext/bg/dictionary.js index 30c34687..d1b9e6b1 100644 --- a/ext/bg/dictionary.js +++ b/ext/bg/dictionary.js @@ -26,7 +26,7 @@ class Dictionary { this.kanjiIndices = {}; } - addTermDict(terms) { + addTermData(terms) { let index = this.terms.length; for (const [e, r, g, t] in terms) { this.storeIndex(this.termIndices, e, index); @@ -35,7 +35,7 @@ class Dictionary { } } - addKanjiDict(kanji) { + addKanjiData(kanji) { let index = this.kanji.length; for (const [c, k, o, g] in kanji) { this.storeIndex(this.kanjiIndices, c, index++); @@ -46,26 +46,14 @@ class Dictionary { findTerm(term) { return (this.termIndices[term] || []).map(index => { const [e, r, g, t] = this.terms[index]; - return { - id: index, - expression: e, - reading: r, - glossary: g, - tags: t.split(' ') - }; + return {id: index, expression: e, reading: r, glossary: g, tags: t.split(' ')}; }); } findKanji(kanji) { return (this.kanjiIndices[kanji] || []).map(index => { const [c, k, o, g] = def; - return { - id: kanji.charCodeAt(0), - character: c, - kunyomi: k, - onyomi: o, - glossary: g - }; + return {id: index, character: c, kunyomi: k, onyomi: o, glossary: g}; }); } -- cgit v1.2.3