rime-ice/others/script/main.go

51 lines
1.1 KiB
Go
Raw Normal View History

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)
2023-04-19 14:20:07 +02:00
// 临时
2023-04-28 17:57:40 +02:00
rime.Temp()
2023-04-19 14:20:07 +02:00
2022-10-30 16:47:40 +01:00
// Emoji 检查和更新
2023-04-13 11:04:44 +02:00
rime.CheckAndGenerateEmoji()
2022-10-30 16:47:40 +01:00
fmt.Println("--------------------------------------------------")
2023-04-13 11:04:44 +02:00
// 为 ext、tencent 没权重的词条加上权重,有权重的改为下面设置的权重
2022-10-30 16:47:40 +01:00
rime.AddWeight(rime.ExtPath, rime.DefaultWeight)
rime.AddWeight(rime.TencentPath, rime.DefaultWeight)
fmt.Println("--------------------------------------------------")
2023-04-13 11:04:44 +02:00
// 检查
// _type: 1 只有汉字 2 汉字+注音 3 汉字+注音+权重 4 汉字+权重
rime.Check(rime.HanziPath, 3)
rime.Check(rime.BasePath, 3)
rime.Check(rime.ExtPath, 4)
rime.Check(rime.TencentPath, 4)
fmt.Println("--------------------------------------------------")
2022-10-30 16:47:40 +01:00
2023-04-13 11:04:44 +02:00
areYouOK()
2022-10-30 16:47:40 +01:00
2023-04-13 11:04:44 +02:00
// 排序,顺便去重
2022-10-30 16:47:40 +01:00
rime.Sort(rime.HanziPath, 3)
rime.Sort(rime.BasePath, 3)
2023-04-13 11:04:44 +02:00
rime.Sort(rime.ExtPath, 4)
rime.Sort(rime.TencentPath, 4)
2022-10-30 16:47:40 +01:00
}
2023-04-13 11:04:44 +02:00
func areYouOK() {
fmt.Println("Are you OK:")
2022-10-30 16:47:40 +01:00
var isOK string
_, _ = fmt.Scanf("%s", &isOK)
if strings.ToLower(isOK) != "ok" {
os.Exit(123)
}
}