Skip to content

Commit

Permalink
feat: 不派生中英混输词库的大些形式; close #344
Browse files Browse the repository at this point in the history
  • Loading branch information
iDvel committed Jun 13, 2023
1 parent 67979e9 commit 6f51bdd
Show file tree
Hide file tree
Showing 8 changed files with 2,755 additions and 2,741 deletions.
911 changes: 456 additions & 455 deletions en_dicts/cn_en.dict.yaml

Large diffs are not rendered by default.

911 changes: 456 additions & 455 deletions en_dicts/cn_en_double_pinyin.dict.yaml

Large diffs are not rendered by default.

911 changes: 456 additions & 455 deletions en_dicts/cn_en_double_pinyin_abc.dict.yaml

Large diffs are not rendered by default.

911 changes: 456 additions & 455 deletions en_dicts/cn_en_double_pinyin_flypy.dict.yaml

Large diffs are not rendered by default.

911 changes: 456 additions & 455 deletions en_dicts/cn_en_double_pinyin_mspy.dict.yaml

Large diffs are not rendered by default.

911 changes: 456 additions & 455 deletions en_dicts/cn_en_double_pinyin_ziguang.dict.yaml

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions melt_eng.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,19 @@ speller:
- derive/[@]//
- derive/[-]//
- derive/[_]//

# 下面带 ⓘ 的,是为了中英混输词库不派生出纯大写

# 派生无任何非字母数字字符的拼写
- derive/[^a-zA-Z0-9]//
- derive/[^a-zA-Z0-9ⓘ]//
# 禁用非英文、数字开头的编码
- erase/^[\W|_].+$/
- erase/^[^a-zA-Z0-9ⓘ].+$/
# 全小写
- derive/^.+$/\L$0/
# 全大写
- derive/^.+$/\U$0/
- derive/^(?!ⓘ).+$/\U$0/
# 首字母大写
- derive/^./\U$0/
- derive/^(?!ⓘ)./\U$0/
# 前 2~10 个字母大写
- derive/^([a-z]{2})/\U$1/
- derive/^([a-z]{3})/\U$1/
Expand All @@ -106,6 +109,9 @@ speller:
- derive/^([a-z]{8})/\U$1/
- derive/^([a-z]{9})/\U$1/
- derive/^([a-z]{10})/\U$1/
# 派生中英混输词库(词库编码以ⓘ开头)
- derive/^ⓘ(.+)$/$1/
- derive/^ⓘ(.+)$/\L$1/

translator:
dictionary: melt_eng
Expand Down
16 changes: 9 additions & 7 deletions others/script/rime/cn_en.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ var polyphones = map[string]string{
"AB血型 > 血": "xue",
"O型血 > 血": "xue",
"O血型 > 血": "xue",
"没Bug > 没": "mei",
"没有Bug > 没": "mei",
"卡Bug > 卡": "ka",
"提Bug > 提": "ti",
"没bug > 没": "mei",
"没有bug > 没": "mei",
"卡bug > 卡": "ka",
"查bug > 查": "cha",
"提bug > 提": "ti",
"CT检查 > 查": "cha",
"N卡 > 卡": "ka",
"A卡 > 卡": "ka",
Expand Down Expand Up @@ -412,7 +413,7 @@ func CnEn() {
uniq.Add(line)
for _, schema := range schemas {
code := textToPinyin(line, schema)
_, err := schema.file.WriteString(line + "\t" + code + "\n")
_, err := schema.file.WriteString(line + "\t" + "ⓘ" + code + "\n")
if err != nil {
log.Fatalln(err)
}
Expand All @@ -432,8 +433,9 @@ func writePrefix(s schema) {
#
# https://github.com/iDvel/rime-ice
# ------- 中英混输词库 for %s -------
# 由 others/cn_en.txt 生成
#
# 由 others/cn_en.txt 自动生成
# 编码前的 ⓘ 符号是为了防止英文方案拼写派生时派生出全大写字母
# 示例:输入 txu 得到 T恤;输入 Txu 得到 T恤; 输入 TXU 则只会得到 TXU
---
name: %s
version: "1"
Expand Down

0 comments on commit 6f51bdd

Please sign in to comment.