1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-12-08 22:50:40 +08:00
parent 152af5ec4e
commit dac5a5c471
6 changed files with 105211 additions and 3692 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

38
original/3/convert.js Normal file
View File

@@ -0,0 +1,38 @@
const fs = require('fs');
const path = require('path');
const utils = require('../../utils');
const input = fs.readFileSync(path.join(__dirname, './data.txt'), 'utf8')
let list = input.trim().replace(/[\r\n]+/g, "\n").split("\n")
console.log(list)
let radical = ""
let isWord = false
let pinyin = []
for (let i = 0; i < list.length; i++) {
const item = list[i].trim()
let match = item.match(/(.) 部首的汉字/)
if (match) {
// 新的偏旁部首开始了
radical = match[1]
} else {
// 这是汉字或者拼音
if (!isWord) {
// 拼音
pinyin = item.split(' ').sort()
} else {
// 汉字
let struct = utils.structure()
struct.word = item
struct.pinyin = pinyin
struct.type = 2
struct.from.push("3")
utils.addData(struct, false)
// console.log(item, pinyin)
}
isWord = !isWord
}
}
utils.saveData()
console.log("done")

26770
original/3/data.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +1,3 @@
1 https://zhuanlan.zhihu.com/p/429504173 1 https://zhuanlan.zhihu.com/p/429504173
2 https://baike.baidu.com/item/%E5%B8%B8%E7%94%A8%E5%AD%97/10071115?fr=aladdin 2 https://baike.baidu.com/item/%E5%B8%B8%E7%94%A8%E5%AD%97/10071115?fr=aladdin
3 https://m.gdzz114.com/shengpizi.html

View File

@@ -65,11 +65,22 @@ function addData(wordStruct, saveData = true) {
// 合并类型 // 合并类型
if (wordStruct.type > 0 && wordStruct.type != struct.type) { if (wordStruct.type > 0 && wordStruct.type != struct.type) {
if (struct.type != 0) { if (struct.type != 0) {
console.log(`${wordStruct.word} 字的类型(type)出现歧义 [${struct.type}, ${wordStruct.type}],当前保存 ${wordStruct.type}`) // 同时在生僻字和常见字出现 记为常见字
console.log(`${wordStruct.word} 字的类型(type)出现歧义 [${struct.type}, ${wordStruct.type}],当前保存 1`)
struct.type = 1
} }
struct.type = wordStruct.type struct.type = wordStruct.type
} }
// 合并来源
for (let fr of wordStruct.from) {
if (!struct.from.includes(fr)) {
struct.from.push(fr)
isNeedUpdate = true
}
}
struct.from.sort()
if (isNeedUpdate) { if (isNeedUpdate) {
data[word] = struct data[word] = struct
saveData && saveData() saveData && saveData()