2022-10-30 16:47:40 +01:00
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"log"
|
|
|
|
|
"os"
|
|
|
|
|
"script/rime"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
|
|
|
|
|
2022-11-03 07:16:48 +01:00
|
|
|
|
// 临时用的
|
|
|
|
|
// rime.Temp()
|
|
|
|
|
// return
|
|
|
|
|
|
2022-10-30 16:47:40 +01:00
|
|
|
|
// Emoji 检查和更新
|
|
|
|
|
rime.CheckEmoji()
|
|
|
|
|
rime.UpdateEmojiTXT()
|
|
|
|
|
fmt.Println("--------------------------------------------------")
|
|
|
|
|
|
|
|
|
|
// 更新搜狗流行词
|
|
|
|
|
rime.UpdateSogou()
|
|
|
|
|
fmt.Println("--------------------------------------------------")
|
|
|
|
|
|
|
|
|
|
// 为 sogou、ext、tencent 没权重的词条加上权重,有权重的改为下面设置的权重
|
|
|
|
|
rime.AddWeight(rime.SogouPath, rime.DefaultWeight)
|
2023-02-23 19:09:29 +01:00
|
|
|
|
rime.AddWeight(rime.MoegirlPath, rime.DefaultWeight)
|
2022-10-30 16:47:40 +01:00
|
|
|
|
rime.AddWeight(rime.ExtPath, rime.DefaultWeight)
|
|
|
|
|
rime.AddWeight(rime.TencentPath, rime.DefaultWeight)
|
|
|
|
|
fmt.Println("--------------------------------------------------")
|
|
|
|
|
|
|
|
|
|
// 通用检查
|
|
|
|
|
// flag: 1 只有汉字,2 汉字+注音,3 汉字+注音+权重,4 汉字+权重。
|
|
|
|
|
go rime.Check(rime.HanziPath, 3)
|
2022-11-10 12:30:00 +01:00
|
|
|
|
go rime.Check(rime.BasePath, 3)
|
2022-10-30 16:47:40 +01:00
|
|
|
|
go rime.Check(rime.SogouPath, 3)
|
2023-02-23 19:09:29 +01:00
|
|
|
|
go rime.Check(rime.MoegirlPath, 3)
|
2022-10-30 16:47:40 +01:00
|
|
|
|
go rime.Check(rime.ExtPath, 4)
|
|
|
|
|
go rime.Check(rime.TencentPath, 4)
|
|
|
|
|
|
|
|
|
|
wait()
|
|
|
|
|
|
|
|
|
|
// 排序
|
|
|
|
|
rime.Sort(rime.HanziPath, 3)
|
2022-11-10 12:30:00 +01:00
|
|
|
|
rime.Sort(rime.BasePath, 3)
|
|
|
|
|
rime.Sort(rime.SogouPath, 3) // 对 base 中已经有的,去重
|
2023-02-23 19:09:29 +01:00
|
|
|
|
rime.Sort(rime.MoegirlPath, 3) // 对 base、sogou 中已经有的,去重
|
|
|
|
|
rime.Sort(rime.ExtPath, 4) // 对 base、sogou、moegirl 中已经有的,去重
|
|
|
|
|
rime.Sort(rime.TencentPath, 4) // 对 base、sogou、moegirl、ext 中已经有的,去重
|
2023-01-17 17:47:12 +01:00
|
|
|
|
// rime.SortEnDict(rime.EnPath)
|
2022-10-30 16:47:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func wait() {
|
|
|
|
|
fmt.Println("检查完成后输入 OK 以继续。。。")
|
|
|
|
|
var isOK string
|
|
|
|
|
_, _ = fmt.Scanf("%s", &isOK)
|
|
|
|
|
if strings.ToLower(isOK) != "ok" {
|
|
|
|
|
os.Exit(123)
|
|
|
|
|
}
|
|
|
|
|
fmt.Println("--------------------------------------------------")
|
|
|
|
|
}
|