Giter VIP home page Giter VIP logo

kanji_dictionary's Introduction

Kanji Dictionary

pub package

Dart implementation of KANJIDIC, a popular Kanji dictionary used by https://jisho.org/. See https://www.edrdg.org/wiki/index.php/KANJIDIC_Project.

Features

  • lists out all the characters of KANJIDIC.
  • lists out ordered beginner-friendly list of Kanji.
  • meanings per language.
  • readings per language.
  • difficulty by JLPT level and grade.
  • index from 21 books.
  • can also parse a custom version of KANJIDIC xml.

Getting started

Add the package as a dependency.

Usage

Basic usage

import 'package:kanji_dictionary/kanji_dictionary.dart';

void main() async {
  final kanjiDictionary = await KanjiDictionary.instance;
  final character = kanjiDictionary.get('亜')!;
  print(character.literal);
  print(character.meanings[Language.english]);
  print(character.readings[Reading.japaneseOn]);
  print(character.readings[Reading.japaneseKun]);
  print(character.difficulty.jlpt);
}

Prints out:

亜
[Asia, rank next, come after, -ous]
[ア]
[つ.ぐ]
1

Listing the 15 easiest Kanji

import 'package:kanji_dictionary/kanji_dictionary.dart';

void main() async {
  final kanjiDictionary = await KanjiDictionary.instance;
  print(kanjiDictionary.charactersByDifficulty
      .take(15)
      .map((c) => c.literal)
      .join(' '));
}

Prints out:

一 二 三 四 五 六 七 八 九 十 百 千 日 月 火

Using your own custom KANJIDIC xml

import 'dart:io';

main() async {
  final xmlKanjidic = await File([your own kanjidic2.xml]).readAsString();
  final kanjiDictionary = await KanjiDictionary.fromXml(xmlKanjidic);
}

Contributing

If you want to contribute, you should clone the project, then generate kanjidic2xml.dart by running:

dart bin/generate_kanji_dic2_const.dart

kanji_dictionary's People

Contributors

atn832 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.