kanji_dictionary 1.0.0 kanji_dictionary: ^1.0.0 copied to clipboard
Dart implementation of KANJIDIC, a popular Kanji dictionary.
Kanji Dictionary #
Dart implementation of KANJIDIC, a popular Kanji dictionary. See http://www.edrdg.org/wiki/index.php/KANJIDIC_Project.
Features #
- lists out all the characters of KANJIDIC.
- meanings per language.
- difficulty by jlpt level and grade.
- 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() {
final kanjiDictionary = KanjiDictionary.instance;
final character = kanjiDictionary.characters.first;
print(character.literal);
print(character.getMeanings(Language.english));
print(character.difficulty.jlpt);
}
Prints out:
亜 [Asia, rank next, come after, -ous] 1
Using your own custom KANJIDIC xml #
import 'dart:io';
main() {
final xmlKanjidic = File([your own kanjidic2.xml]).readAsStringSync();
final kanjiDictionary = KanjiDictionary.fromXml(XmlDocument.parse(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