1
0
Fork 0

add extend

This commit is contained in:
程序员小墨 2022-12-08 23:36:39 +08:00
parent aa8aae4b4a
commit f3cc95b629
6 changed files with 1323 additions and 1 deletions

File diff suppressed because it is too large Load Diff

1
data-single-word.txt Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
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 a-zA-Z0-9-_~!@#$%^&*\(\)<>?:\"\{\},\.\/;'\[\]\|\\=+·!?【】()《》;:,。、…「」〔〕‘’“”»\t ©→]/g, "")
console.log(list)
console.log()
list = Array.from(new Set(list.split(''))).sort((a, b) => a.localeCompare(b)).join('')
console.log(list)
for (let word of list) {
// 汉字
let struct = utils.structure()
struct.word = word
// struct.from.push("extand")
utils.addData(struct, false)
}
utils.saveData()
console.log("done")

1
original/extand/data.txt Normal file

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@ const path = require('path');
const DataFile = path.join(__dirname, './data.json')
const DataFile2 = path.join(__dirname, './data-friendly.json')
const DataFile3 = path.join(__dirname, './data-single-word.txt')
let data = JSON.parse(fs.readFileSync(DataFile, 'utf8'))
function structure() {
@ -36,6 +37,7 @@ function saveData() {
data = ObjSort(data)
fs.writeFileSync(DataFile, JSON.stringify(data), 'utf8')
fs.writeFileSync(DataFile2, JSON.stringify(data, null, 4), 'utf8')
fs.writeFileSync(DataFile3, Object.keys(data).join(''), 'utf8')
}
function addData(wordStruct, saveData = true) {