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
8 changed files with 40 additions and 33 deletions

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