add extend
This commit is contained in:
parent
aa8aae4b4a
commit
f3cc95b629
1296
data-friendly.json
1296
data-friendly.json
File diff suppressed because it is too large
Load Diff
1
data-single-word.txt
Normal file
1
data-single-word.txt
Normal file
File diff suppressed because one or more lines are too long
22
original/extand/convert.js
Normal file
22
original/extand/convert.js
Normal 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
1
original/extand/data.txt
Normal file
File diff suppressed because one or more lines are too long
2
utils.js
2
utils.js
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user