This commit is contained in:
Alex Yatskov 2016-04-01 22:30:30 -07:00
parent 92e62c798d
commit 036639aeaf
3 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ class Dictionary {
addTermData(terms) {
let index = this.terms.length;
for (const [e, r, g, t] in terms) {
for (const [e, r, g, t] of terms) {
this.storeIndex(this.termIndices, e, index);
this.storeIndex(this.termIndices, r, index++);
this.terms.push([e, r, g, t]);
@ -37,7 +37,7 @@ class Dictionary {
addKanjiData(kanji) {
let index = this.kanji.length;
for (const [c, k, o, g] in kanji) {
for (const [c, k, o, g] of kanji) {
this.storeIndex(this.kanjiIndices, c, index++);
this.kanji.push([c, k, o, g]);
}

View File

@ -42,7 +42,7 @@ class Translator {
break;
case 'edict':
case 'enamdict':
this.dictionary.addTermsData(Translator.parseCsv(response));
this.dictionary.addTermData(Translator.parseCsv(response));
break;
}
@ -159,7 +159,7 @@ class Translator {
static parseCsv(data) {
const result = [];
for (const row in data.split('\n')) {
for (const row of data.split('\n')) {
result.push(row.split('\t'));
}

View File

@ -21,9 +21,9 @@ class Yomichan {
constructor() {
this.res = {
rules: 'bg/data/rules.json',
edict: 'bg/data/edict.json',
enamdict: 'bg/data/enamdict.json',
kanjidic: 'bg/data/kanjidic.json'
edict: 'bg/data/edict.csv',
enamdict: 'bg/data/enamdict.csv',
kanjidic: 'bg/data/kanjidic.csv'
};
this.translator = new Translator();