Thanks to visit codestin.com
Credit goes to Github.com

Skip to content
/ Henkan Public

Converter & Simplifier for JMdict, KANJIDIC, KRADFILE2, RADKFILE2 and Tanaka Corpus

License

Notifications You must be signed in to change notification settings

Ronokof/Henkan

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.

npm license CI codecov


Table of contents


Install

# npm
npm install henkan

# or yarn
yarn add henkan

# or pnpm
pnpm add 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.

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');

API

See API README


Contributing

See CONTRIBUTING.md

License

This library is licensed under the MIT License.

About

Converter & Simplifier for JMdict, KANJIDIC, KRADFILE2, RADKFILE2 and Tanaka Corpus

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •