add 4
This commit is contained in:
		
							
								
								
									
										157989
									
								
								data-friendly.json
									
									
									
									
									
								
							
							
						
						
									
										157989
									
								
								data-friendly.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										37
									
								
								original/4/convert.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								original/4/convert.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
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]+/g, "\n").split("\n")
 | 
			
		||||
console.log(list)
 | 
			
		||||
let radical = ""
 | 
			
		||||
let isWord = false
 | 
			
		||||
let pinyin = []
 | 
			
		||||
for (let i = 0; i < list.length; i++) {
 | 
			
		||||
    const item = list[i].trim()
 | 
			
		||||
    let match = item.match(/(.) 字母开头的汉字/)
 | 
			
		||||
    if (match) {
 | 
			
		||||
        // 新的字母开头开始了
 | 
			
		||||
        radical = match[1]
 | 
			
		||||
    } else {
 | 
			
		||||
        // 这是汉字或者拼音
 | 
			
		||||
        if (!isWord) {
 | 
			
		||||
            // 拼音
 | 
			
		||||
            pinyin = item.split(' ').sort()
 | 
			
		||||
        } else {
 | 
			
		||||
            // 汉字
 | 
			
		||||
            let struct = utils.structure()
 | 
			
		||||
            struct.word = item
 | 
			
		||||
            struct.pinyin = pinyin
 | 
			
		||||
            struct.from.push("4")
 | 
			
		||||
            utils.addData(struct, false)
 | 
			
		||||
            // console.log(item, pinyin)
 | 
			
		||||
        }
 | 
			
		||||
        isWord = !isWord
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
utils.saveData()
 | 
			
		||||
console.log("done")
 | 
			
		||||
							
								
								
									
										74418
									
								
								original/4/data.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74418
									
								
								original/4/data.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,3 +1,4 @@
 | 
			
		||||
1   https://zhuanlan.zhihu.com/p/429504173
 | 
			
		||||
2   https://baike.baidu.com/item/%E5%B8%B8%E7%94%A8%E5%AD%97/10071115?fr=aladdin
 | 
			
		||||
3   https://m.gdzz114.com/shengpizi.html
 | 
			
		||||
3   https://m.gdzz114.com/shengpizi.html
 | 
			
		||||
4   https://m.gdzz114.com/dictionary/a.html
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user