@nahanil/zhdict-lite
v0.0.2
Published
Access extended CC-CEDICT dictionary data
Downloads
7
Readme
@nahanil/zhdict-lite
Fallback data source for zhdict.net
npm install --save @nahanil/zhdict-lite
# OR
yarn add @nahanil/zhdict-lite
const dict = require('@nahanil/zhdict-lite')
Search for a word or character
let results = await dict.search('水')
/*
* Always returns an array of results
[
{
"id": "3f69904700c4fe2fb2caeb3f46501bc66ce245a4",
"simplified": "水",
"traditional": "水",
"pinyin": "shui3",
"hskLevel": 1,
"english": "surname Shui/water/river/...",
"radicalSimplified": "水",
"radicalTraditional": "水",
"strokesSimplified": 4,
"strokesTraditional": 4,
"strokesMinRadSimplified": 0,
"strokesMinRadTraditional": 0,
"variantsSimplified": null,
"variantsTraditional": null,
"variants": "氵"
}
]
*/
let results = await dict.search('你好')
/*
[
{
id: 'd3e4b9c5d696fe124825709a9a73aa3f01c61b2a',
simplified: '你好',
traditional: '你好',
pinyin: 'ni3 hao3',
english: 'hello/hi',
hskLevel: null,
radicalSimplified: null,
radicalTraditional: null,
strokesSimplified: null,
strokesTraditional: null,
strokesMinRadSimplified: null,
strokesMinRadTraditional: null,
variantsSimplified: null,
variantsTraditional: null,
variants: null
}
]
*/
Search for a word or character by radical
let results = await dict.searchByRadical('水')
/*
* Always returns an array of results
[
{
"id": "3f69904700c4fe2fb2caeb3f46501bc66ce245a4",
"simplified": "水",
"traditional": "水",
"pinyin": "shui3",
"english": "surname Shui/water/river/liquid/beverage/...",
"radicalSimplified": "水",
"radicalTraditional": "水",
"strokesSimplified": 4,
"strokesTraditional": 4,
"strokesMinRadSimplified": 0,
"strokesMinRadTraditional": 0,
"variantsSimplified": null,
"variantsTraditional": null,
"variants": "氵"
},
// ...
]
*/