Code Monkey home page Code Monkey logo

yomichan-dict-reader's Introduction

Yomichan Dict Reader

npm version

A module for reading Yomichan zip files.

Install:

npm i yomichan-dict-reader

Not yet supported:

  • Frequency dictionaries
  • Expanded tag detail (from a term- or dictionary-meta-bank)

Initialize:

const Yomichan = require('yomichan-dict-reader');
const yomichan = new Yomichan();
const JMDictPath = './test/[Bilingual] JMdict (English) Alternate.zip';
yomichan.readDictionary(JMDictPath).then(() => {
  // do stuff
});

Get readings of a kanji term:

// [ 'いえ', 'うち', 'け', 'や', 'か', 'んち' ]
yomichan.getReadingsForTerm('家');

Get kanji terms for a reading:

// [
// '宵', '余意',
// '良い', '善い',
// '好い', '佳い',
// '吉い', '宜い',
// '酔い'
// ]
yomichan.getTermsForReading('よい');

Get definitions as an array:

// [
//   {
//     term: '宵',
//     reading: 'よい',
//     tags: 'n',
//     deinflectors: '',
//     popularity: 209,
//     definitions: [ 'evening', 'early night hours' ],
//     sequence: 1347600,
//     bigTags: 'news spec',
//     dict: './test/[Bilingual] JMdict (English) Alternate.zip'
//   }
// ]
yomichan.getDefinitionsForTermReading('宵', 'よい');

Get the deinflectors as a string for a term-reading pair:

// 'v5'
yomichan.getDeinflectorsForTermReading('出す', 'だす');

Get all the data in a dictionary as an object:

await yomichan.getAllEntriesFromDict(JMDictPath);

Get all the terms in a dictionary as a set:

await yomichan.getAllTermsInDict(JMDictPath);

Check if a dictionary contains a specific term:

// true
yomichan.dictContains(JMDictPath, '家');

Read a kanji dictionary:

const KANJIDICPath = './test/kanjidic_english.zip';
await yomichan.readKanjiDictionary(KANJIDICPath);

Get kanji data:

// [
//   {
//     character: '家',
//     onyomi: 'カ ケ',
//     kunyomi: 'いえ や うち',
//     tags: 'jouyou',
//     meaningsArr: [
//       'house',
//       'home',
//       'family',
//       'professional',
//       'expert',
//       'performer'
//     ],
//     statsObj: {
//       busy_people: '2.8',
//       crowley: '46',
//       deroo: '751',
//       four_corner: '3023.2',
//       freq: '133',
//       gakken: '81',
//       grade: '2',
//       halpern_kkd: '2827',
//       halpern_kkld: '1458',
//       halpern_kkld_2ed: '1963',
//       halpern_njecd: '2273',
//       heisig: '541',
//       heisig6: '580',
//       henshall: '83',
//       henshall3: '89',
//       jf_cards: '158',
//       jis208: '1-18-40',
//       jlpt: '3',
//       kanji_in_context: '52',
//       kodansha_compact: '480',
//       maniette: '547',
//       moro: '7169',
//       nelson_c: '1311',
//       nelson_n: '1337',
//       oneill_kk: '151',
//       oneill_names: '1185',
//       sakade: '53',
//       sh_desc: '3m7.1',
//       sh_kk: '165',
//       sh_kk2: '165',
//       skip: '2-3-7',
//       strokes: '10',
//       tutt_cards: '189',
//       ucs: '5bb6'
//     },
//     dict: './test/kanjidic_english.zip'
//   }
// ]
yomichan.getKanjiInfo('家', KANJIDICPath);

yomichan-dict-reader's People

Contributors

marvnc avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.