Skip to content

Commit

Permalink
add schema name prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
hertz-hwang committed Dec 23, 2024
1 parent d7b6f0a commit a915917
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
21 changes: 21 additions & 0 deletions lua/hertz/prompt_filter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- prompt_filter.lua
-- encoding: utf-8
-- CC-BY-4.0

local function F(input, env)
schema_name = env.engine.schema.config:get_string("schema/name")
local ctx = env.engine.context
local segment = ctx.composition:back()

if segment then
segment.prompt = " [ " .. schema_name .. " ]"
-- 保持原有的候选项不变
for cand in input:iter() do
yield(cand)
end
end

return true
end

return F
3 changes: 2 additions & 1 deletion tiger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ switches_engine_table:
- lua_filter@*hertz.easy_en*enhance_filter # 英文增强
- lua_filter@*hertz.embeded_cands@embeded_cands
- lua_filter@*hertz.tiger_pin*pin_filter
- lua_filter@*hertz.prompt_filter

switches_engine_script:
switches:
Expand Down Expand Up @@ -253,7 +254,7 @@ switches_engine_script:
- uniquifier # 过滤重复的候选字,可能来自简繁转换
- lua_filter@*hertz.easy_en*enhance_filter # 英文增强
- lua_filter@*hertz.tiger_pin*pin_filter

- lua_filter@*hertz.prompt_filter
keys:
emacs_mode:
__append:
Expand Down
32 changes: 24 additions & 8 deletions tiger_phrase_chord.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ translator:
# 自动分词标记
- xform/([a-z]{1,4})[_]/$1␣/
# 其余处理
- xform/([A-Z])/\L$1/
#- xform/([A-Z])/\L$1/
- xform/([A-Z])/$1°/ # 其它提示符 ° ∞ ᵆ ʬ ˜
- xform/([¹²³⁴][a-z]+)[_']/$1/
- xform/([¹²³⁴])_/$1/
- xform/_/␣/
Expand Down Expand Up @@ -128,13 +129,28 @@ chord_composer:
use_super: false
use_caps: false
finish_trigger_release_num: 999
finish_chord_on_first_key_release: false
alphabet: qazwsxedcrfvtgbyhnujmikolp
finish_chord_on_first_key_release: true
alphabet: qazwsxedcrfvtgbyhnujmikolp `
#alphabet: qazwsxedcrfvtgbyhnujmik,ol.p;/ `

algebra:
- xform=([qwertasdgzxcvb])j=\U$1=
- xform=f([yuiophklnm])=\U$1=
- xform=df=F=
- xform=jk=J=
#- xlit|;,./|ACXZ|
- xlit| |一| # 主空格
- xform=([qwertasdfgzxcvb])一=\U$1=
- xform=([yuiophjklnm])一=\U$1=
#- xform=df=F=
#- xform=jk=J=


- xform|(.)_一|"1$1_|
- xform|_(.)一|"1_$1|
- xform|(..)一|"1$1|
- xform|^一|1|

- xform/1/ /
- xform/"1/"/

#- xform/^.*.+.*$//
- xform=,="""",=
- xform=。="""".=
- xform=!=""""!=
- xform=?=""""?=

0 comments on commit a915917

Please sign in to comment.