Fixes
This commit is contained in:
parent
92e62c798d
commit
036639aeaf
@ -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]);
|
||||
}
|
||||
|
@ -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'));
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user