diff --git a/en_dicts/cn_en.txt b/en_dicts/cn_en.txt index 0c705ea..4fdd4a4 100644 --- a/en_dicts/cn_en.txt +++ b/en_dicts/cn_en.txt @@ -908,3 +908,5 @@ TF版本 TFbanben TF版本 tfbanben O不OK ObuOK O不OK obuok +人均GDP renjunGDP +人均GDP renjungdp diff --git a/en_dicts/cn_en_abc.txt b/en_dicts/cn_en_abc.txt index c405b9e..a44da18 100644 --- a/en_dicts/cn_en_abc.txt +++ b/en_dicts/cn_en_abc.txt @@ -908,3 +908,5 @@ TF版本 TFbjbf TF版本 tfbjbf O不OK ObuOK O不OK obuok +人均GDP rfjnGDP +人均GDP rfjngdp diff --git a/en_dicts/cn_en_double_pinyin.txt b/en_dicts/cn_en_double_pinyin.txt index e9036d3..d1fb0a2 100644 --- a/en_dicts/cn_en_double_pinyin.txt +++ b/en_dicts/cn_en_double_pinyin.txt @@ -908,3 +908,5 @@ TF版本 TFbjbf TF版本 tfbjbf O不OK ObuOK O不OK obuok +人均GDP rfjpGDP +人均GDP rfjpgdp diff --git a/en_dicts/cn_en_flypy.txt b/en_dicts/cn_en_flypy.txt index 1f9ed3d..37448e8 100644 --- a/en_dicts/cn_en_flypy.txt +++ b/en_dicts/cn_en_flypy.txt @@ -908,3 +908,5 @@ TF版本 TFbjbf TF版本 tfbjbf O不OK ObuOK O不OK obuok +人均GDP rfjyGDP +人均GDP rfjygdp diff --git a/en_dicts/cn_en_mspy.txt b/en_dicts/cn_en_mspy.txt index 0654d22..63f63ca 100644 --- a/en_dicts/cn_en_mspy.txt +++ b/en_dicts/cn_en_mspy.txt @@ -908,3 +908,5 @@ TF版本 TFbjbf TF版本 tfbjbf O不OK ObuOK O不OK obuok +人均GDP rfjpGDP +人均GDP rfjpgdp diff --git a/en_dicts/cn_en_sogou.txt b/en_dicts/cn_en_sogou.txt index a4dc365..7d65b2d 100644 --- a/en_dicts/cn_en_sogou.txt +++ b/en_dicts/cn_en_sogou.txt @@ -908,3 +908,5 @@ TF版本 TFbjbf TF版本 tfbjbf O不OK ObuOK O不OK obuok +人均GDP rfjpGDP +人均GDP rfjpgdp diff --git a/en_dicts/cn_en_ziguang.txt b/en_dicts/cn_en_ziguang.txt index 9ef6162..9f5afac 100644 --- a/en_dicts/cn_en_ziguang.txt +++ b/en_dicts/cn_en_ziguang.txt @@ -908,3 +908,5 @@ TF版本 TFbrbw TF版本 tfbrbw O不OK ObuOK O不OK obuok +人均GDP rwjmGDP +人均GDP rwjmgdp diff --git a/en_dicts/en.dict.yaml b/en_dicts/en.dict.yaml index f11e8ea..6d0bc40 100644 --- a/en_dicts/en.dict.yaml +++ b/en_dicts/en.dict.yaml @@ -7911,7 +7911,6 @@ GCC GCC # GCSE GCSE # gd gd # GDB GDB -GDP GDP # ge ge gear gear geared geared diff --git a/en_dicts/en_ext.dict.yaml b/en_dicts/en_ext.dict.yaml index b83bc58..79b38f3 100644 --- a/en_dicts/en_ext.dict.yaml +++ b/en_dicts/en_ext.dict.yaml @@ -331,8 +331,10 @@ APC APC Ability Power Carry APC Ability Power Carry AbilityPowerCarry GDP GDP +GDP per capita GDPpercapita Gross Domestic Product GDP Gross Domestic Product GrossDomesticProduct +Gross Domestic Product per capita GrossDomesticProductpercapita LOL LOL League of Legends LOL League of Legends LeagueofLegends diff --git a/others/cn_en.txt b/others/cn_en.txt index 295d3a2..1976a37 100644 --- a/others/cn_en.txt +++ b/others/cn_en.txt @@ -460,3 +460,4 @@ QQ三国 TF版 TF版本 O不OK +人均GDP diff --git a/others/script/go.mod b/others/script/go.mod index 224788b..6fab3d7 100644 --- a/others/script/go.mod +++ b/others/script/go.mod @@ -4,4 +4,7 @@ go 1.20 require github.com/deckarep/golang-set/v2 v2.3.0 -require github.com/yanyiwu/gojieba v1.3.0 +require ( + github.com/yanyiwu/gojieba v1.3.0 + golang.org/x/sys v0.19.0 +) diff --git a/others/script/go.sum b/others/script/go.sum index cc70885..bd3c764 100644 --- a/others/script/go.sum +++ b/others/script/go.sum @@ -2,3 +2,5 @@ github.com/deckarep/golang-set/v2 v2.3.0 h1:qs18EKUfHm2X9fA50Mr/M5hccg2tNnVqsiBI github.com/deckarep/golang-set/v2 v2.3.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/yanyiwu/gojieba v1.3.0 h1:6VeaPOR+MawnImdeSvWNr7rP4tvUfnGlEKaoBnR33Ds= github.com/yanyiwu/gojieba v1.3.0/go.mod h1:54wkP7sMJ6bklf7yPl6F+JG71dzVUU1WigZbR47nGdY= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/others/script/main.go b/others/script/main.go index 9bff072..3ef4c54 100644 --- a/others/script/main.go +++ b/others/script/main.go @@ -71,7 +71,8 @@ func areYouOK() { fmt.Println("Are you OK:") var isOK string _, _ = fmt.Scanf("%s", &isOK) - if strings.ToLower(isOK) != "ok" { + isOK = strings.ToLower(isOK) + if isOK != "ok" && isOK != "y" && isOK != "yes" { os.Exit(123) } } diff --git a/others/script/rime/rime.go b/others/script/rime/rime.go index 58e9c0b..75dcdd0 100644 --- a/others/script/rime/rime.go +++ b/others/script/rime/rime.go @@ -4,11 +4,13 @@ import ( "bufio" "fmt" mapset "github.com/deckarep/golang-set/v2" + "golang.org/x/sys/windows/registry" "log" "os" "os/user" "path" "path/filepath" + "runtime" "strconv" "strings" "time" @@ -22,8 +24,8 @@ type lemma struct { } var ( - mark = "# +_+" // 词库中的标记符号,表示从这行开始进行检查或排序 - RimeDir = getRimeDir() // Rime 配置目录 + mark = "# +_+" // 词库中的标记符号,表示从这行开始进行检查或排序 + RimeDir = getRimeDir() // Rime 配置目录 EmojiMapPath = filepath.Join(RimeDir, "others/emoji-map.txt") EmojiPath = filepath.Join(RimeDir, "opencc/emoji.txt") @@ -43,13 +45,54 @@ var ( 汉字拼音映射TXT = filepath.Join(RimeDir, "others/script/rime/汉字拼音映射.txt") ) -// 获取 macOS Rime 配置目录 +// 获取 macOS/Windows Rime 配置目录 func getRimeDir() string { - u, err := user.Current() - if err != nil { - log.Fatalln(err) + var dir string + switch runtime.GOOS { + case "darwin": // macOS + u, err := user.Current() + if err != nil { + log.Fatalln(err) + } + dir = filepath.Join(u.HomeDir, "Library/Rime") + case "windows": // Windows + dir = getWeaselDir() + default: + log.Fatalf("Unsupported OS: %s so far", runtime.GOOS) } - return filepath.Join(u.HomeDir, "Library/Rime") + + return dir +} + +func getWeaselDir() string { + keyPath := `Software\Rime\Weasel` + valueName := "RimeUserDir" + + // Get from Windows registry + k, err := registry.OpenKey(registry.CURRENT_USER, keyPath, registry.QUERY_VALUE) + if err != nil { + log.Printf("Failed to open registry key: %v\n", err) + // Fallback to default dir + return getDefaultWeaselDir() + } + defer k.Close() + + rimeUserDir, _, err := k.GetStringValue(valueName) + if err != nil { + log.Printf("Failed to read registry value: %v\n", err) + // Fallback to default dir + return getDefaultWeaselDir() + } + + return rimeUserDir +} + +func getDefaultWeaselDir() string { + appData := os.Getenv("APPDATA") // AppData\Roaming + if appData == "" { + log.Fatalln("APPDATA environment variable is not set.") + } + return filepath.Join(appData, "Rime") } // 将所有词库读入 set,供检查或排序使用