Skip to content

Commit

Permalink
feat: 单字模式
Browse files Browse the repository at this point in the history
  • Loading branch information
boomker committed Oct 20, 2024
1 parent 6da9a03 commit 2f6eb58
Show file tree
Hide file tree
Showing 16 changed files with 10,150 additions and 326 deletions.
9,734 changes: 9,734 additions & 0 deletions cn_dicts/flyhe_chars.dict.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion cn_dicts/flypy_tencent.dict.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154993,7 +154993,6 @@ sort: by_weight
准专家 vy vr jx 1
准专业 vy vr ye 1
准准准 vy vy vy 1
准网站 vy wh vj 1
准新车 vy xb ie 1
准新人 vy xb rf 1
准新生 vy xb ug 1
Expand Down
16 changes: 10 additions & 6 deletions flypy_xhfast.custom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ patch:
- name: emoji
states: [🈚️, 😄]
reset: 1
- name: charset
states: [通用, 增廣]
reset: 1
- name: prediction
states: [联想关, 联想开]
reset: 0
- name: extend_charset
states: [通用, 增廣]
reset: 1
- name: charset_comment
- name: char_mode
states: [单字模式关, 单字模式开]
# reset: 0
- name: charset_hint
states: [码区提示关, 码区提示开]
reset: 0

Expand All @@ -49,7 +52,8 @@ patch:
key_binder/+:
import_preset: default # 从 default.yaml 继承通用的
# search: "`" # 辅码引导符
char_mode: "|" # 单字模式(四码词组->四码单字)
char_mode_suffix: "|" # 单字优先触发后缀(四码词组->四码单字)
char_mode: "Control+s" # 单字模式
pin_cand: "Control+t" # 候选词置顶
unpin_cand: "Control+t" # 候选词取消置顶
drop_cand: "Control+d" # 强制删词, 无视输入的编码
Expand Down Expand Up @@ -80,7 +84,7 @@ patch:
- {when: composing, accept: Control+o, send: Control+Right}
- {when: composing, accept: Control+w, send: Control+BackSpace}
- {when: has_menu, accept: Control+Shift+slash, toggle: emoji}
- {when: has_menu, accept: Control+Shift+comma, toggle: charset_comment}
- {when: has_menu, accept: Control+Shift+comma, toggle: charset_hint}

recognizer/+:
patterns/+:
Expand Down
17 changes: 9 additions & 8 deletions flypy_xhfast.dict.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ name: flypy_xhfast
version: "2024-07-29"

import_tables:
- cn_dicts/flypy_chars # 字表
# - cn_dicts/flypy_chars_ext # 扩展字表
- cn_dicts/flypy_base # 基础词库
- cn_dicts/flypy_ext # 扩展词库
- cn_dicts/flypy_sogou # 搜狗网络流行词库
- cn_dicts/flypy_wuhgit # from github.com/wuhgit
- cn_dicts/flypy_tencent # 腾讯词库(大词库, 部署时间较长)
- cn_dicts/flypy_ext_misc # 大写字母和数字派生, V开头Emoji
- cn_dicts/flypy_chars # 字表
# - cn_dicts/flyhe_chars # 字表
# - cn_dicts/flypy_chars_ext # 扩展字表
- cn_dicts/flypy_base # 基础词库
- cn_dicts/flypy_ext # 扩展词库
- cn_dicts/flypy_sogou # 搜狗网络流行词库
- cn_dicts/flypy_wuhgit # from github.com/wuhgit
- cn_dicts/flypy_tencent # 腾讯词库(大词库, 部署时间较长)
- cn_dicts/flypy_ext_misc # 大写字母和数字派生, V开头Emoji
# - cn_dicts/flypy_super_ext1 # 扩展词库(大词库, 部署时间较长)
# - cn_dicts/flypy_super_ext2 # 扩展词库(大词库, 部署时间较长)
# - cn_dicts/flypy_super_ext3 # 扩展词库(大词库, 部署时间较长)
Expand Down
19 changes: 8 additions & 11 deletions flypy_xhfast.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ switches:
states: [中, En]
- name: ascii_punct
states: [。, .]
reset: 0
- name: full_shape
states: [半角, 全角]
reset: 0
- name: simplification
states: [简, 繁]
reset: 0

# 输入引擎
engine:
Expand Down Expand Up @@ -86,10 +84,10 @@ engine:
- lua_translator@*chinese_lunar # /nl 触发显示中国农历
- lua_translator@*chinese_number # /cn 触发大写金额数字
- lua_translator@*flypy_help_menu # /oh 触发进入帮助菜单
- lua_translator@*launcher*translator # /jk, /fj 触发快捷命令
- lua_translator@*launcher*translator # /jk, /kj 触发快捷命令
- lua_translator@*word_autocaps*translator # A-Z 大写字母开头触发单词自动大写
- lua_translator@*commit_history*translator # /hs 触发显示上屏历史
- lua_translator@*flypy_switcher*translator # /so 触发进入选项切换菜单
- lua_translator@*word_autocaps*translator # A-Z 大写字母开头触发单词自动大写
- lua_translator@*word_autocommit*translator # / 单字优先和成语短语自动触发上屏
- script_translator
filters:
Expand Down Expand Up @@ -304,8 +302,7 @@ key_binder:
- {when: always, accept: "Control+comma", toggle: ascii_punct}
- {when: always, accept: "Control+period", toggle: full_shape}
- {when: always, accept: "Control+slash", toggle: simplification}
- {when: always, accept: Control+Shift+semicolon, select: easy_en}
# - { when: always, accept: Control+1, send_sequence: 'HelloWorld' }
- {when: always, accept: "Control+Shift+semicolon", select: easy_en}

# 拼写设定
speller:
Expand All @@ -330,11 +327,11 @@ algebra_common:
- erase/^m\[\w+$/ # 取消「呣 m」的独占

## 字表编码到输入码的转换规则
# - derive/^(\w+)\[(\w)(\w)$/$1\[$2$3/ # Flypy: AB[CD
# - derive/^(\w+)\[(\w)(\w)$/$1\[$2/ # Flypy: AB[C
- derive|^(\w+)\[(\w)(\w)$|$1/$2$3| # Flypy: AB/CD
- derive|^(\w+)\[(\w)(\w)$|$1/$2| # Flypy: AB/C
- derive/^(\w+)\[(\w)(\w)$/$1/ # Flypy: AB
# - derive/^(\w+)\[(\w)(\w)$/$1\[$2$3/ # Flypy: AB[CD
# - derive/^(\w+)\[(\w)(\w)$/$1\[$2/ # Flypy: AB[C
- derive|^(\w+)\[(\w)(\w)$|$1/$2$3| # Flypy: AB/CD
- derive|^(\w+)\[(\w)(\w)$|$1/$2| # Flypy: AB/C
- derive/^(\w+)\[(\w)(\w)$/$1/ # Flypy: AB

# 响应 ` 造词
- derive/^(\w+)\[(\w)(\w)$/$1`$2$3/ # Flypy: AB`CD
Expand Down
4 changes: 2 additions & 2 deletions lua/charset.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ filter 的输出与 translator 相同,也是若干候选项,也要求您使
--]]
local function charset_filter(input, env)
-- 使用 `iter()` 遍历所有输入候选项
local extended = env.engine.context:get_option("extend_charset")
local extended = env.engine.context:get_option("charset")

if extended then
for cand in input:iter() do
Expand All @@ -100,7 +100,7 @@ end
--]]
local function charset_comment_filter(input, env)
-- 使用 `iter()` 遍历所有输入候选项
local comment_toggle = env.engine.context:get_option("charset_comment")
local comment_toggle = env.engine.context:get_option("charset_hint")
for cand in input:iter() do
-- 判断当前候选内容 `cand.text` 中文字属哪个字符集
if comment_toggle then
Expand Down
Loading

0 comments on commit 2f6eb58

Please sign in to comment.