feat: 英文降频 all 将合并 words 内容 (#650)

This commit is contained in:
Mintimate 2024-01-30 10:17:35 +08:00 committed by GitHub
parent fd9561e288
commit 58cfa406c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 40 additions and 33 deletions

View File

@ -120,12 +120,12 @@ corrector: "{comment}"
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
# 几种模式:
# all 降低所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母的单词
# all 降低脚本内置的单词(所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母words 作为自定义的额外补充
# custom 完全自定义,只降低 words 里的
# none 不降低任何单词,相当于没有启用这个 Lua
# custom 自定义,只降低 words 里的
# (匹配的是编码,不是单词)
reduce_english_filter:
mode: custom # all | none | custom
mode: custom # all | custom | none
idx: 2 # 降低到第 idx 个位置
# 自定义的单词列表,示例列表没有降低部分常用单词,如 and cat mail Mac but bad shit ……
words: [aid, ann,

View File

@ -120,12 +120,12 @@ corrector: "{comment}"
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
# 几种模式:
# all 降低所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母的单词
# all 降低脚本内置的单词(所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母words 作为自定义的额外补充
# custom 完全自定义,只降低 words 里的
# none 不降低任何单词,相当于没有启用这个 Lua
# custom 自定义,只降低 words 里的
# (匹配的是编码,不是单词)
reduce_english_filter:
mode: custom # all | none | custom
mode: custom # all | custom | none
idx: 2 # 降低到第 idx 个位置
# 自定义的单词列表,示例列表没有降低部分常用单词,如 and cat mail Mac but bad shit ……
words: [aid, ann,

View File

@ -120,12 +120,12 @@ corrector: "{comment}"
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
# 几种模式:
# all 降低所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母的单词
# all 降低脚本内置的单词(所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母words 作为自定义的额外补充
# custom 完全自定义,只降低 words 里的
# none 不降低任何单词,相当于没有启用这个 Lua
# custom 自定义,只降低 words 里的
# (匹配的是编码,不是单词)
reduce_english_filter:
mode: custom # all | none | custom
mode: custom # all | custom | none
idx: 2 # 降低到第 idx 个位置
# 自定义的单词列表,示例列表没有降低部分常用单词,如 and cat mail Mac but bad shit ……
words: [aid, ann,

View File

@ -120,12 +120,12 @@ corrector: "{comment}"
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
# 几种模式:
# all 降低所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母的单词
# all 降低脚本内置的单词(所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母words 作为自定义的额外补充
# custom 完全自定义,只降低 words 里的
# none 不降低任何单词,相当于没有启用这个 Lua
# custom 自定义,只降低 words 里的
# (匹配的是编码,不是单词)
reduce_english_filter:
mode: custom # all | none | custom
mode: custom # all | custom | none
idx: 2 # 降低到第 idx 个位置
# 自定义的单词列表,示例列表没有降低部分常用单词,如 and cat mail Mac but bad shit ……
words: [aid, ann,

View File

@ -120,12 +120,12 @@ corrector: "{comment}"
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
# 几种模式:
# all 降低所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母的单词
# all 降低脚本内置的单词(所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母words 作为自定义的额外补充
# custom 完全自定义,只降低 words 里的
# none 不降低任何单词,相当于没有启用这个 Lua
# custom 自定义,只降低 words 里的
# (匹配的是编码,不是单词)
reduce_english_filter:
mode: custom # all | none | custom
mode: custom # all | custom | none
idx: 2 # 降低到第 idx 个位置
# 自定义的单词列表,示例列表没有降低部分常用单词,如 and cat mail Mac but bad shit ……
words: [aid, ann,

View File

@ -120,12 +120,12 @@ corrector: "{comment}"
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
# 几种模式:
# all 降低所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母的单词
# all 降低脚本内置的单词(所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母words 作为自定义的额外补充
# custom 完全自定义,只降低 words 里的
# none 不降低任何单词,相当于没有启用这个 Lua
# custom 自定义,只降低 words 里的
# (匹配的是编码,不是单词)
reduce_english_filter:
mode: custom # all | none | custom
mode: custom # all | custom | none
idx: 2 # 降低到第 idx 个位置
# 自定义的单词列表,示例列表没有降低部分常用单词,如 and cat mail Mac but bad shit ……
words: [aid, ann,

View File

@ -1,6 +1,9 @@
-- 降低部分英语单词在候选项的位置
-- https://dvel.me/posts/make-rime-en-better/#短单词置顶的问题
-- 感谢大佬 @[Shewer Lu](https://github.com/shewer) 指点
-- Mintimate 修改:
-- 1. 在不设置 mode 情况下,调整为默认全降模式(原本为 none 模式);
-- 2. all 会合并默认全降内容和自定义内容。
local M = {}
@ -35,17 +38,17 @@ function M.init(env)
"pam", "pan", "pans", "pant", "pap", "par", "pat", "paw", "pax", "pay", "pens", "pic", "pier", "pies", "pig",
"pin", "ping", "pink", "pins", "pint", "pit", "pix", "pod", "pop", "por", "pos", "pot", "pour", "pow", "pub",
"put", "rand", "rang", "rank", "rant", "red", "rent", "rep", "res", "ret", "rex", "rib", "rid", "rig", "rim",
"rip", "rub", "rug", "ruin", "rum", "run", "runc", "runs", "sac", "sad", "said", "sail", "sal", "sam", "san", "sand",
"sang", "sans", "sap", "sat", "saw", "sax", "say", "sec", "send", "sent", "set", "sew", "sex", "sham", "shaw",
"shed", "shin", "ship", "shit", "shut", "sig", "sim", "sin", "sip", "sir", "sis", "sit", "six", "soul", "soup",
"sour", "sub", "suit", "sum", "sun", "sung", "suns", "sup", "sur", "sus", "tab", "tad", "tag", "tail", "taj",
"tan", "tang", "tank", "tap", "tar", "tax", "tec", "ted", "tel", "ten", "ter", "tex", "tic", "tied", "tier",
"ties", "tim", "tin", "tip", "tit", "tour", "tout", "tum", "wag", "wait", "wail", "wan", "wand", "womens",
"rip", "rub", "rug", "ruin", "rum", "run", "runc", "runs", "sac", "sad", "said", "sail", "sal", "sam", "san",
"sand", "sang", "sans", "sap", "sat", "saw", "sax", "say", "sec", "send", "sent", "set", "sew", "sex", "sham",
"shaw", "shed", "shin", "ship", "shit", "shut", "sig", "sim", "sin", "sip", "sir", "sis", "sit", "six", "soul",
"soup", "sour", "sub", "suit", "sum", "sun", "sung", "suns", "sup", "sur", "sus", "tab", "tad", "tag", "tail",
"taj", "tan", "tang", "tank", "tap", "tar", "tax", "tec", "ted", "tel", "ten", "ter", "tex", "tic", "tied",
"tier", "ties", "tim", "tin", "tip", "tit", "tour", "tout", "tum", "wag", "wait", "wail", "wan", "wand", "womens",
"want", "wap", "war", "was", "wax", "way", "weir", "went", "won", "wow", "yan", "yang", "yen", "yep", "yes",
"yet", "yin", "your", "yum", "zen", "zip",
-- 下面是其他长度的
"quanx", "eg",
}
}
M.all = {}
for _, v in ipairs(all) do
M.all[v] = true
@ -54,19 +57,23 @@ function M.init(env)
-- 自定义
M.words = {}
local list = config:get_list(env.name_space .. "/words")
for i = 0, list.size - 1 do
local listSize = list and list.size or 0
for i = 0, listSize - 1 do
local word = list:get_value_at(i).value
M.words[word] = true
end
-- 模式
local mode = config:get_string(env.name_space .. "/mode")
if mode == "all" then
M.map = M.all
elseif mode == "custom" then
if mode == "custom" then
M.map = M.words
else
elseif mode == "none" then
M.map = {}
else -- 默认 mode 为 all 且合并 M.all 和 words
for key in pairs(M.words) do
M.all[key] = true
end
M.map = M.all
end
end

View File

@ -109,12 +109,12 @@ corrector: "{comment}"
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
# 降低之后: 输入 rug 得到 「1.如果 2.rug …… 」
# 几种模式:
# all 降低所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母的单词
# all 降低脚本内置的单词(所有 3~4 位长度、前 2~3 位是完整拼音、最后一位是声母words 作为自定义的额外补充
# custom 完全自定义,只降低 words 里的
# none 不降低任何单词,相当于没有启用这个 Lua
# custom 自定义,只降低 words 里的
# (匹配的是编码,不是单词)
reduce_english_filter:
mode: custom # all | none | custom
mode: custom # all | custom | none
idx: 2 # 降低到第 idx 个位置
# 自定义的单词列表,示例列表没有降低部分常用单词,如 and cat mail Mac but bad shit ……
words: [aid, ann,