rime-ice/others/script/main.go
Dvel 196a0ea7a6 日常更新
commit c0e8fce9c547e08baa2690be038a0b22dba9e2a2
Author: Dvel <git@dvel.me>
Date:   Fri Feb 24 09:49:58 2023 +0800

    update recipes

commit b94b5e2b6b1a6e5968a4b79020c4797d01773317
Author: Dvel <git@dvel.me>
Date:   Fri Feb 24 09:48:52 2023 +0800

    Update README.md

commit 09b2fac8fdb91691154a87a1e9401633ca45b3e8
Author: Dvel <git@dvel.me>
Date:   Fri Feb 24 09:42:24 2023 +0800

    完善萌娘相关脚本

commit 0cedf23ffc796d8d18f042d2dbe963ad578d5860
Author: Dvel <git@dvel.me>
Date:   Fri Feb 24 08:28:35 2023 +0800

    Emoji 映射移动到 base 里
2023-02-24 09:52:38 +08:00

68 lines
1.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

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.

package main
import (
"fmt"
"log"
"os"
"script/rime"
"strings"
)
func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
// 临时用的
// rime.Temp()
// return
// Emoji 检查和更新
rime.CheckEmoji()
rime.UpdateEmojiTXT()
fmt.Println("--------------------------------------------------")
// 更新搜狗流行词
rime.UpdateSogou()
fmt.Println("--------------------------------------------------")
// 更新萌娘百科
rime.UpdateMoegirl()
fmt.Println("--------------------------------------------------")
// 为 sogou、ext、tencent 没权重的词条加上权重,有权重的改为下面设置的权重
rime.AddWeight(rime.SogouPath, rime.DefaultWeight)
rime.AddWeight(rime.MoegirlPath, rime.DefaultWeight)
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)
go rime.Check(rime.BasePath, 3)
go rime.Check(rime.SogouPath, 3)
go rime.Check(rime.MoegirlPath, 3)
go rime.Check(rime.ExtPath, 4)
go rime.Check(rime.TencentPath, 4)
wait()
// 排序
rime.Sort(rime.HanziPath, 3)
rime.Sort(rime.BasePath, 3)
rime.Sort(rime.SogouPath, 3) // 对 base 中已经有的,去重
rime.Sort(rime.MoegirlPath, 3) // 对 base、sogou 中已经有的,去重
rime.Sort(rime.ExtPath, 4) // 对 base、sogou、moegirl 中已经有的,去重
rime.Sort(rime.TencentPath, 4) // 对 base、sogou、moegirl、ext 中已经有的,去重
// rime.SortEnDict(rime.EnPath)
}
func wait() {
fmt.Println("检查完成后输入 OK 以继续。。。")
var isOK string
_, _ = fmt.Scanf("%s", &isOK)
if strings.ToLower(isOK) != "ok" {
os.Exit(123)
}
fmt.Println("--------------------------------------------------")
}