Skip to content

cedict-json individual json data of dictionary term according to simplified terms in cedict

Notifications You must be signed in to change notification settings

krmanik/cedict-json

Repository files navigation

cedict-json

cedict-json individual json data of dictionary term according to simplified terms.

Quick Start

  1. Fork this repository
  2. Get meaning using cdn for v2 data
https://cdn.jsdelivr.net/gh/<your-username>/cedict-json/v2/我.json

Note: <your-username> is your GitHub username

  1. The v2 data
{
    "simplified": "",
    "traditional": "",
    "pinyin": [
        "wo3"
    ],
    "definitions": {
        "wo3": "I; me; my; "
    }
}
  1. Multiple meanings are separated by semi-color ;. For e.g. three meaning for
    "definitions": {
        "wo3": "I; me; my; "
    }

Version 2

Generated using toJson.py script

Difference between Version 1 (v1) and Version 2 (v2) data

Some words (approx. 3000) have same character and different pinyin and meaning. So using toJson.py words merged. For e.g. have more than one pinyin and meaning. But in version 1 there is one pinyin. So use v2 for getting meaning data. Also the multiple meanings are separated by semi-colon ; for respective pinyin.

{
    "simplified": "",
    "traditional": "",
    "pinyin": [
        "de5",
        "di1",
        "di2",
        "di4"
    ],
    "definitions": {
        "de5": "of; ~'s (possessive particle); (used after an attribute); (used to form a nominal expression); (used at the end of a declarative sentence for emphasis); ",
        "di1": "see 的士[di1 shi4]; ",
        "di2": "really and truly; ",
        "di4": "aim; clear; "
    }
}

Version 1

Generated using following script:

with open('cedict.json', encoding='utf8') as json_file:
    data = json.load(json_file)
    for x in range(0, 114852):
        print(data[x]['simplified'])
        name = data[x]['simplified']
        name += '.json'
        
        with open(name, "w", encoding='utf8') as f:
            json.dump(data[x],f,indent=4,sort_keys=True, ensure_ascii=False)

cedict.json file generated using following:

https://github.com/kevb34ns/CEDICT2JSON

To get meaning of any term from cedict-json data

Example 1

https://cdn.jsdelivr.net/gh/<your-username>/cedict-json/data/我.json

Fork this and then,
your-username is your github username

Fetched data

{
    "definitions": [
        "I",
        "my"
    ],
    "pinyin": "wo3",
    "simplified": "",
    "traditional": ""
}

Example 2

https://cdn.jsdelivr.net/gh/infinyte7/cedict-json/data/知道.json

Fetched data

{
    "definitions": [
        "to know",
        "also pr. [zhi1 dao5]"
    ],
    "pinyin": "zhi1 dao4",
    "simplified": "知道",
    "traditional": "知道"
}

Apps and Websites using cedict-json

Simple 中文 Vocabulary Generator

License

cedict chinese dictionary

Creative Commons Attribution-Share Alike 4.0 License
https://cc-cedict.org/wiki/

cedict-json

Mani (Infinyte7)
Creative Commons Attribution-Share Alike 4.0 License

Python packages used

hanziconv
googletrans
colorize_pinyin

About

cedict-json individual json data of dictionary term according to simplified terms in cedict

Resources

Stars

Watchers

Forks

Packages