fix: v 模式的少许 Bug

This commit is contained in:
Dvel 2023-01-19 18:36:43 +08:00
parent 708522aeb6
commit ae9840446d
3 changed files with 33 additions and 38 deletions

View File

@ -189,30 +189,25 @@ function long_word_filter(input, env)
end
end
-------------------------------------------------------------
-- 因为英文方案的 initial_quality 大于 1导致输入「va」时候选项是「van vain。。。」
-- 单字优先,候选项应改为「ā á ǎ à」
--
-- 不知道这个方法为什么不行啊???
-- function v_single_char_first_filter(input)
-- if (string.find(input, "v") == 1 and string.len(input) == 2) then
-- local l = {}
-- for cand in input:iter() do
-- if (utf8.len(cand.text) == 1) then
-- yield(cand)
-- else
-- table.insert(l, cand)
-- end
-- end
-- for cand in ipairs(l) do
-- yield(cand)
-- end
-- end
-- end
--
-- 反正是解决了,不知道怎么就解决了,就是最后多一个候选项,没多大影响。
function v_single_char_first_filter(input, seg)
if (string.find(input, "v") == 1 and string.len(input) == 2) then
yield(Candidate("", seg.start, seg._end, "", ""))
-- v 模式,单个字符优先
-- 因为设置了英文翻译器的 initial_quality 大于 1导致输入「va」时候选项是「van vain …… ā á ǎ à」
-- 把候选项应改为「ā á ǎ à …… van vain」让单个字符的排在前面
function v_filter(input, env)
local code = env.engine.context.input -- 当前编码
local l = {}
for cand in input:iter() do
if (cand.text == "Vs.") then -- 特殊情况处理
yield(cand)
end
-- 以 v 开头、2 个长度的编码、候选项为单个字符的,提到前面来。
if (string.len(code) == 2 and string.find(code, "v") == 1 and utf8.len(cand.text) == 1) then
yield(cand)
else
table.insert(l, cand)
end
end
for i, cand in ipairs(l) do
yield(cand)
end
end
-------------------------------------------------------------

View File

@ -6,7 +6,7 @@
schema:
schema_id: rime_ice
name: 雾凇拼音
version: "1.1.0"
version: "1.2.0"
author:
- Dvel
description: |
@ -60,7 +60,6 @@ engine:
translators:
- punct_translator
- script_translator
- lua_translator@v_single_char_first_filter # v 模式 symbols 优先(否则是英文优先)
- lua_translator@date_translator # 时间、日期、星期
- table_translator@custom_phrase # 自定义短语 custom_phrase.txt
- table_translator@melt_eng # 英文输入
@ -70,6 +69,7 @@ engine:
- lua_filter@long_word_filter # 长词优先
- simplifier@emoji # Emoji
- simplifier@traditionalize # 简繁切换
- lua_filter@v_filter # v 模式 symbols 优先(否则是英文优先)
- uniquifier # 去重

View File

@ -16,7 +16,7 @@
# 一些韵母前四位顺序改为「一声、二声、三声、四声、其他...」如输入 va 得到 ā á ǎ à
config_version: '2022-11-08'
config_version: '2023-01-19'
punctuator:
@ -202,7 +202,7 @@ punctuator:
'vy': [ȳ, ý, ỳ, ŷ, ẏ, ÿ, ẙ, ỹ, ʸ, ɏ, ỷ, ỵ, ƴ, ʎ, ỿ, ]
'vY': [Ȳ, Ý, Ỳ, Ŷ, Ẏ, Ÿ, Ỹ, ʏ, Ɏ, Ỷ, Ỵ, Ƴ, Ỿ ]
'vz': [ź, ž, ẑ, ż, ᶻ, ʐ, ᶼ, ʑ, ᶽ, ƶ, ẕ, ẓ, ᵶ, ȥ, ⱬ, ᶎ, ʒ, ᶾ, ǯ, ʓ, ƹ, ƺ, ᶚ, θ, ᶿ, ɀ, ꝣ]
'vZ': [Ź, Ž, Ẑ, Ż, , Ƶ, Ẕ, Ẓ, Ȥ, Ⱬ Ʒ, ᴣ, Ǯ, Ƹ, Ɀ, Ꝣ]
'vZ': [Ź, Ž, Ẑ, Ż, , Ƶ, Ẕ, Ẓ, Ȥ, Ⱬ, Ʒ, ᴣ, Ǯ, Ƹ, Ɀ, Ꝣ]
'vaa': [ꜳ]
'vAA': [Ꜳ]
'vae': [æ, ǣ, ǽ, ᵆ, ᴂ]