24 lines
768 B
JavaScript
24 lines
768 B
JavaScript
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, "")
|
||
|
||
list = Array.from(new Set(list.split(''))).sort((a, b) => a.localeCompare(b)).join('')
|
||
// console.log(list)
|
||
fs.writeFileSync(path.join(__dirname, './output.txt'), list, 'utf8')
|
||
// return
|
||
|
||
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")
|