1
0
Fork 0

添加部首字段

This commit is contained in:
程序员小墨 2022-12-08 22:34:27 +08:00
parent e666f43224
commit 152af5ec4e
4 changed files with 3761 additions and 1 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

24
update-data.js Normal file
View File

@ -0,0 +1,24 @@
const fs = require('fs');
const path = require('path');
const DataFile = path.join(__dirname, './data.json')
const DataFile2 = path.join(__dirname, './data-friendly.json')
let data = JSON.parse(fs.readFileSync(DataFile, 'utf8'))
Object.keys(data).forEach(key => {
// data[key].radical = []
// 保证字典 key 顺序
data[key] = {
"word": data[key].word,
"pinyin": data[key].pinyin,
"radical": [],
"stroke": data[key].stroke,
"type": data[key].type,
"from": data[key].from,
"confirm": data[key].confirm
}
})
fs.writeFileSync(DataFile, JSON.stringify(data), 'utf8')
fs.writeFileSync(DataFile2, JSON.stringify(data, null, 4), 'utf8')

View File

@ -11,6 +11,8 @@ function structure() {
word: "",
// 拼音
pinyin: [],
// 部首
radical: [],
// 笔画
stroke: 0,
// 类型 0-未标注 1-常用字 2-生僻字