feat:save

This commit is contained in:
zyronon
2025-07-22 00:14:51 +08:00
parent 60c0273e15
commit ba1dbdfbb1
10 changed files with 81 additions and 132 deletions

View File

@@ -1,3 +0,0 @@
[
"an"
]

View File

@@ -1,5 +0,0 @@
{
"韦氏词根词典": [
"philippic"
]
}

View File

@@ -1,29 +0,0 @@
[
{
"id": 1330,
"word": "an",
"trans": [
{
"pos": "indefinite article",
"cn": "一(个)〔用于以元音开头的单词前〕",
"en": "used when the following word begins with a vowel sound"
}
],
"phonetic0": "ən,æn",
"phonetic1": "ə ; æn",
"sentences": [
{
"v": "一个橘子",
"tran": "an orange"
},
{
"v": "一次X光检查",
"tran": "an X-ray"
}
],
"relWords": [],
"phrases": [],
"synos": [],
"memory": ""
}
]

View File

@@ -1,37 +0,0 @@
let path = require("path");
let fs = require("fs");
//词典来自https://github.com/kajweb/dict
//下载json词典放到dict目录下
let read = './dict/'
let save = "./res/";
//判断是不是目录
const dirs = fs.readdirSync(read)
dirs.forEach(dictName => {
formatDict(read, dictName)
})
// formatDict(read, 'BEC_2.json')
function formatDict(path, name) {
try {
let newObj = []
let str = fs.readFileSync(path + name, "utf8");
let list = str.split('\n')
list.map(v => {
if (!v) return
let item = JSON.parse(v)
// console.log('v', item.headWord)
newObj.push(item.headWord)
})
// fs.writeFileSync(save + name, JSON.stringify(newObj, null, 2));
fs.writeFileSync(save + name.replace('.json', '_word.json'), JSON.stringify(newObj));
console.log(name, newObj.length)
} catch (e) {
console.log('err', name, e)
}
}

View File

@@ -1,37 +0,0 @@
let path = require("path");
let fs = require("fs");
const axios = require('axios')
let str = fs.readFileSync('./save/allNew.min.json', "utf8");
let failStr = fs.readFileSync('./fail.txt', "utf8");
let failList = JSON.parse(failStr)
let list = JSON.parse(str)
async function sleep(val) {
return new Promise(resolve => {
setTimeout(resolve, val)
})
}
let s = []
function fail(word) {
s.push(word)
console.log('失败:', s.length)
fs.writeFileSync('./failWord.txt', JSON.stringify(s, null, 2));
}
// console.log('failList',failList)
async function test() {
for (let i = 0; i < list.length; i++) {
// for (let i = 0; i < 3000; i++) {
let v = list[i]
if (failList.includes(v.word)) {
console.log('进度', v.word)
fail(v)
}
}
}
test()