Fixes
This commit is contained in:
parent
92e62c798d
commit
036639aeaf
@ -28,7 +28,7 @@ class Dictionary {
|
|||||||
|
|
||||||
addTermData(terms) {
|
addTermData(terms) {
|
||||||
let index = this.terms.length;
|
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, e, index);
|
||||||
this.storeIndex(this.termIndices, r, index++);
|
this.storeIndex(this.termIndices, r, index++);
|
||||||
this.terms.push([e, r, g, t]);
|
this.terms.push([e, r, g, t]);
|
||||||
@ -37,7 +37,7 @@ class Dictionary {
|
|||||||
|
|
||||||
addKanjiData(kanji) {
|
addKanjiData(kanji) {
|
||||||
let index = this.kanji.length;
|
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.storeIndex(this.kanjiIndices, c, index++);
|
||||||
this.kanji.push([c, k, o, g]);
|
this.kanji.push([c, k, o, g]);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class Translator {
|
|||||||
break;
|
break;
|
||||||
case 'edict':
|
case 'edict':
|
||||||
case 'enamdict':
|
case 'enamdict':
|
||||||
this.dictionary.addTermsData(Translator.parseCsv(response));
|
this.dictionary.addTermData(Translator.parseCsv(response));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ class Translator {
|
|||||||
|
|
||||||
static parseCsv(data) {
|
static parseCsv(data) {
|
||||||
const result = [];
|
const result = [];
|
||||||
for (const row in data.split('\n')) {
|
for (const row of data.split('\n')) {
|
||||||
result.push(row.split('\t'));
|
result.push(row.split('\t'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ class Yomichan {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.res = {
|
this.res = {
|
||||||
rules: 'bg/data/rules.json',
|
rules: 'bg/data/rules.json',
|
||||||
edict: 'bg/data/edict.json',
|
edict: 'bg/data/edict.csv',
|
||||||
enamdict: 'bg/data/enamdict.json',
|
enamdict: 'bg/data/enamdict.csv',
|
||||||
kanjidic: 'bg/data/kanjidic.json'
|
kanjidic: 'bg/data/kanjidic.csv'
|
||||||
};
|
};
|
||||||
|
|
||||||
this.translator = new Translator();
|
this.translator = new Translator();
|
||||||
|
Loading…
Reference in New Issue
Block a user