henkan
v1.1.2
Published
A Node.JS library that helps you convert any dictionary from EDRDG, transform their entries into more user-friendly schemas and create Anki notes from them.
Maintainers
Readme
henkan
A Node.JS library that helps you convert any dictionary from EDRDG, transform their entries into more user-friendly schemas and create Anki notes from them.
The library is used for the Full Japanese Study Deck, so some features might be tailored specifically to the deck.
Table of contents
Install
# npm
npm install henkan
# or yarn
yarn add henkan
# or pnpm
pnpm add henkanFeatures
- JMdict, KANJIDIC, Tanaka Corpus, RADK and KRAD conversion
- User-friendly schemas for dictionary entries
- Anki note generation
- "Japanese definition"-"JMdict entry" pairing (using
ja.wiktionary.orgdumps) - Other useful tools (Amazon Polly audio generation, Japanese RegExps, array checking etc.)
Example
Download the JMdict_e.gz archive and extract JMdict_e from it.
import fs from 'fs';
import { convertJMdict, generateAnkiNotesFile, getWord } from 'henkan';
//const fs = require('fs');
//const { convertJMdict, generateAnkiNotesFile, getWord } = require('henkan');
const dictPath = './JMdict_e';
const dictContent = fs.readFileSync(dictPath, 'utf-8');
const dictWords = convertJMdict(dictContent);
const jmDict = undefined, id = undefined, kanjiDic = undefined, tanakaCorpus = undefined;
const noteTypeName = 'Word';
const deckName = 'Japanese::Vocabulary::No kanji form words';
const noKanjiFormWords = dictWords
.filter(word => word.kanjiForms === undefined)
.map(word => getWord(jmDict, id, kanjiDic, tanakaCorpus, word, noteTypeName, deckName));
const ankiNotesFile = generateAnkiNotesFile(noKanjiFormWords);
if (ankiNotesFile) fs.writeFileSync('./nokfwords.json', ankiNotesFile, 'utf-8');API
See API README
Contributing
See CONTRIBUTING.md
License
This library is licensed under the MIT License.
