dict: 日常更新

This commit is contained in:
Dvel
2023-09-08 19:36:27 +08:00
parent 06467aa0b3
commit 7ebf8ff1fa
10 changed files with 1239 additions and 1375 deletions

View File

@@ -3,6 +3,7 @@ package rime
import (
"bufio"
"fmt"
mapset "github.com/deckarep/golang-set/v2"
"log"
"os"
"strconv"
@@ -17,8 +18,9 @@ func Temp() {
// GeneratePinyinTest("都挺长的")
// GeneratePinyinTest("血条长")
// findP(ExtPath, "")
// findP(BasePath, "")
Pinyin(ExtPath)
AddWeight(ExtPath, 100)
}
// 列出字表中多音字的状况:是否参与自动注音
@@ -107,6 +109,7 @@ func findP(dictPath string, ch string) {
isMark := false
sc := bufio.NewScanner(file)
set := mapset.NewSet[string]() // 去重用的
for sc.Scan() {
line := sc.Text()
if !isMark {
@@ -125,9 +128,10 @@ func findP(dictPath string, ch string) {
log.Fatalln("len(parts) != 3", line)
}
text := parts[0]
if strings.Contains(text, ch) && utf8.RuneCountInString(text) >= 3 {
if strings.Contains(text, ch) && utf8.RuneCountInString(text) >= 3 && !set.Contains(text) {
outFile.WriteString(line + "\n")
} else {
set.Add(text)
lines = append(lines, line)
}
}

View File

@@ -1,4 +1,8 @@
# 在 # -_- 上面是错词;下面是包含错词但不是错词。
阿帕契
德鲁依
唐三才
塔克拉马干
元文件
桃花园
桃花缘