|
|
@@ -8,8 +8,7 @@ async function runScript(){
|
|
8
|
8
|
try {
|
|
9
|
9
|
|
|
10
|
10
|
//按照高频单词的使用频率排序,列出所有单词
|
|
11
|
|
- //const sql="select * from MiaoguoLiteracy where ID>0 order by ID desc;";
|
|
12
|
|
- const sql="SELECT a.ID,b.ID as 'ID2' FROM MiaoguoLiteracy a inner join MiaoguoLiteracy b on a.ID<b.ID and a.Word=b.Word and a.SearchType=b.SearchType where a.SearchType='eng' order by a.ID;";
|
|
|
11
|
+ const sql="select * from MiaoguoLiteracy where ID>0 order by ID desc limit 100;";
|
|
13
|
12
|
|
|
14
|
13
|
let list = await commonModel.RunSql(null,sql);
|
|
15
|
14
|
let count=list.length;
|
|
|
@@ -19,9 +18,32 @@ async function runScript(){
|
|
19
|
18
|
|
|
20
|
19
|
for(let i=start;i<count;i++){
|
|
21
|
20
|
let item=list[i];
|
|
22
|
|
- let sql3="delete from MiaoguoLiteracy where ID="+item.ID2+";";
|
|
23
|
|
- //console.log(sql3);
|
|
24
|
|
- await commonModel.RunSql(null,sql3);
|
|
|
21
|
+ let json=JSON.parse(item.JSONString);
|
|
|
22
|
+ let b=false;
|
|
|
23
|
+ if (json.ENG){
|
|
|
24
|
+ if (!stringUtils.IsArray(json.ENG.Paraphrase)){
|
|
|
25
|
+ json.ENG.Paraphrase=[json.ENG.Paraphrase];
|
|
|
26
|
+ console.log(json.ENG.Paraphras);
|
|
|
27
|
+ b=true;
|
|
|
28
|
+ }
|
|
|
29
|
+ if (!stringUtils.IsArray(json.ENG.Paraphrase[0].ParaphraseList)){
|
|
|
30
|
+ json.ENG.Paraphrase[0].ParaphraseList=[json.ENG.Paraphrase[0].ParaphraseList];
|
|
|
31
|
+ console.log(json.ENG.Paraphrase[0].ParaphraseList);
|
|
|
32
|
+ b=true;
|
|
|
33
|
+ }
|
|
|
34
|
+ }
|
|
|
35
|
+
|
|
|
36
|
+ if (b){
|
|
|
37
|
+ json=JSON.stringify(json);
|
|
|
38
|
+
|
|
|
39
|
+ let sql3="update MiaoguoLiteracy set JSONString=? where ID="+item.ID+";";
|
|
|
40
|
+ //console.log(sql3);
|
|
|
41
|
+ console.log(json);
|
|
|
42
|
+
|
|
|
43
|
+ //await commonModel.RunSql(json,sql3);
|
|
|
44
|
+ process.exit(1);
|
|
|
45
|
+ }
|
|
|
46
|
+
|
|
25
|
47
|
console.log( i +"/"+ list.length+" "+ item.ID);
|
|
26
|
48
|
}
|
|
27
|
49
|
|
|
|
@@ -37,21 +59,3 @@ async function runScript(){
|
|
37
|
59
|
runScript().catch(error => {
|
|
38
|
60
|
console.error('Error in runScript:', error);
|
|
39
|
61
|
});
|
|
40
|
|
-
|
|
41
|
|
-// let a=tiankongFun("时事","shí shì");
|
|
42
|
|
-// console.log(a);
|
|
43
|
|
-function tiankongFun(word,pinyin){
|
|
44
|
|
- let TianKong = [];
|
|
45
|
|
- if (word.length <= 4 && pinyin ) {
|
|
46
|
|
-
|
|
47
|
|
- var arrPinyin = pinyin.split(" ");
|
|
48
|
|
- //console.log(arrPinyin);
|
|
49
|
|
- for (var i = 0; i < word.length; i++) {
|
|
50
|
|
- var str = stringUtils.ReplaceAllString(word,word[i],arrPinyin[i]);
|
|
51
|
|
- //var str=param.Word.substring(0,i)+arrPinyin[i]+param.Word.substring(i+1);
|
|
52
|
|
- TianKong.push(str);
|
|
53
|
|
- }
|
|
54
|
|
- TianKong= _.uniq(TianKong);
|
|
55
|
|
- }
|
|
56
|
|
- return TianKong;
|
|
57
|
|
-}
|