Converter & Simplifier for JMdict, KANJIDIC, KRADFILE2, RADKFILE2 and Tanaka Corpus
npm install henkanA 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.
  !CI 
---
- Install
- Features
- Example
- API
- Contributing
- License
---
``bashnpm
npm install henkan
Features
- 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.org dumps)
- Other useful tools (Japanese RegExps, array checking etc.)---
Example
Download the JMdict_e.gz archive and extract
JMdict_e from it.`js
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, kanjiDic = undefined, tanakaCorpus = undefined, definitions = undefined;
const noteTypeName = 'Word';
const deckName = 'Japanese::Vocabulary::No kanji form words';
const noKanjiFormWords = dictWords
.filter(word => word.kanjiForms === undefined)
.map(word => getWord(word, jmDict, kanjiDic, tanakaCorpus, definitions, noteTypeName, deckName));
const ankiNotesFile = generateAnkiNotesFile(noKanjiFormWords);
fs.writeFileSync('./nokfwords.json', ankiNotesFile, 'utf-8');
``See API README
---
See CONTRIBUTING.md
This library is licensed under the MIT License.