1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
Chinese-characters/original/extand/convert.js
2022-12-08 23:57:50 +08:00

24 lines
768 B
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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")