Kanji Database
Project description
WIP
KanjiDB
Kanji database builder and REST API.
KanjiDB aims to help you build your own kanji database by gathering informations from various existing source. It's plugin system let you write you own plugin to collect and add new data to kanjis, or to arrange already written plugins to meet your needs. It's goal is to be flexible enough to let you export all the informations you need to build your own app (database, viewer, Anki deck builder, ...) and progress in learning Japanese. KanjiDB also comes with a REST API allowing to retrieve those informations and build services uppon.
Install
Using pip:
> pip install kanjidb
Show help:
> python -m kanjidb -h
Usage: kanjidb COMMAND [OPTIONS]
A kanji database accessible via REST API
Options:
-v, --version Print version information and quit
-h, --help Show this help
Commands:
build Build kanji database from sources
run Run local server and REST API
Run 'kanjidb COMMAND --help' for more information on a command.
Building a database
The command kanjidb build
requires a YAML configuration file describing all
steps that will run for building the database. Start by creating a file named config.yml
looking like this:
run:
- kanjistream:
encoding: unicode_plus
separator: ";"
in: "-"
out: kanjis
- kanjidic2:
kd2_file: kanjidic2.xml
in: kanjis
out: db
- jsonwriter:
encoding: unicode_plus
indent: 4
in: db
out:
- db.json
- "-"
Each step listed in run
correspond to a plugin located in kanjidb.builder.plugins
and
can have its own configuration. You can arrange plugins as you want and even run them
multiple times.
In this configuration:
kanjistream
: read kanjis fromsys.stdin
.kanjidic2
: produce a JSON dict with data from external Kanjidic2 XML filekanjidic2.xml
(download).jsonwriter
: write the JSON dict todb.json
andsys.stdout
.
Now running kanjidb build
will produce following output:
> echo "U4E00;U4E8D" | python -m kanjidb build config.yml
{
"U+4e00": {
...
"meanings": [
{
"m_lang": "",
"value": "one"
},
...
]
},
"U+4e8d": {
...
"meanings": [
{
"m_lang": "",
"value": "to take small steps"
},
...
]
}
}
As described in configuration, KanjiDB simply produced a JSON dict containing
Kanjidic2 data for the two kanjis from sys.stdin
. It also created a file
called db.json
containing this JSON dict.
This example give you a glimpse of how KanjiDB works and how you can assemble its plugins to output useful data on kanjis.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file kanjidb-0.1a1.tar.gz
.
File metadata
- Download URL: kanjidb-0.1a1.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cae6f34981f4c4443c3eac2e066d0941e561d61029086aff3cec31f5a59f130 |
|
MD5 | ff4f8aedf385fecd1ea9bce48e03f209 |
|
BLAKE2b-256 | b7984a53dcce5c15914cc8757b5b7cbda75d7e3e228688d3696ebb08cd572d18 |
File details
Details for the file kanjidb-0.1a1-py3-none-any.whl
.
File metadata
- Download URL: kanjidb-0.1a1-py3-none-any.whl
- Upload date:
- Size: 26.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0df42bff7fc1f53d19ff572522971423dbb563a67d596dadeca355e4bca15a8 |
|
MD5 | 05283f0c0fce1bf32a50f4617aab9fbd |
|
BLAKE2b-256 | 2f09d72b30014dca4afbba3f14aa03c78c448c3f641d6916ad4f2c5fa9c37f0b |