Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

临时英文输出方案 #154

Open
huo-feng-ding opened this issue Oct 12, 2024 · 16 comments
Open

临时英文输出方案 #154

huo-feng-ding opened this issue Oct 12, 2024 · 16 comments

Comments

@huo-feng-ding
Copy link

在中文状态时,有没有一个临时输出英文字符的方案; 目前我看到的是开头大写字母是可以的,但是很多时候我想输英文的时候并不是以大写字母开头的。

@bczhc
Copy link

bczhc commented Oct 13, 2024

#138 (comment) 同理呀,

# Z开关输入英文
    english: "Z[a-zA-Z]*$"

就把Z换成其他就行了,比如分号开启临时英文,规则就是^;[a-zA-Z]*$

@huo-feng-ding
Copy link
Author

image

按回车是可以把分号去了,可是我想按空格上屏时把分号去了,应该怎么改一下,谢谢

@bczhc
Copy link

bczhc commented Oct 14, 2024 via email

@bczhc
Copy link

bczhc commented Oct 14, 2024

diff --git a/wubi86_jidian.schema.yaml b/wubi86_jidian.schema.yaml
index 47ffeaf..9466a94 100644
--- a/wubi86_jidian.schema.yaml
+++ b/wubi86_jidian.schema.yaml
@@ -42,6 +42,7 @@ engine:
   segmentors:
     - ascii_segmentor
     - matcher
+    - affix_segmentor@english
     - abc_segmentor
     - punct_segmentor
     - fallback_segmentor
@@ -49,6 +50,7 @@ engine:
     - punct_translator
     - reverse_lookup_translator
     - table_translator
+    - table_translator@english
     - lua_translator@*wubi86_jidian_date_translator # 日期、时间、星期
     - history_translator@repeat_last_input # 重复上一次输入,对应下面的 repeat_last_input
   filters:
@@ -56,7 +58,13 @@ engine:
 #    - lua_filter@*wubi86_jidian_single_char_first_filter # 单字优先
 #    - lua_filter@*wubi86_jidian_single_char_only # 纯单字
 
-
+english:
+  tag: english
+  prefix: ";"              # 反查前缀,以它为起点
+  tips: 〔En〕              # 反查时的提示信息
+  enable_completion: true
+  enable_sentence: false
+  initial_quality: 1.1
 
 # 自动造词功能:参阅: https://github.com/KyleBing/rime-wubi86-jidian#6-%E5%BC%80%E5%90%AF%E8%87%AA%E5%8A%A8%E9%80%A0%E8%AF%8D
 
@@ -122,6 +130,7 @@ recognizer:
   patterns:
 #    punct: "^/([0-9]+[a-z]*|[a-z]+)$" # 注意前方需要有4个空格,跟下面对齐
     reverse_lookup: "^z[a-z]*'?$" # 反查词条的正则
+    english: '^;[a-zA-Z]*$'
 
 # 重复上一次输入
 repeat_last_input:

如果要启用英文词典,把英文方案文件(以melt_eng为例,就是melt_eng.dict.yamlmelt_eng.schema.yaml)复制到此项目之下,再加这两行。

diff --git a/wubi86_jidian.schema.yaml b/wubi86_jidian.schema.yaml
index 9466a94..46045d1 100644
--- a/wubi86_jidian.schema.yaml
+++ b/wubi86_jidian.schema.yaml
@@ -12,6 +12,7 @@ schema:
   description: |
     五笔字形 86 极点极爽版,方案由 KyleBing 修改 - 2019年11月08日 10:26
   dependencies:
+    - melt_eng
 #    - pinyin_simp
 
 switches:
@@ -60,6 +61,7 @@ engine:
 
 english:
   tag: english
+  dictionary: melt_eng
   prefix: ";"              # 反查前缀,以它为起点
   tips: 〔En〕              # 反查时的提示信息
   enable_completion: true

@huo-feng-ding
Copy link
Author

遇到高人了,实在是太牛了,简单的几个配置就搞定了。
我还在想是不是得用lua来处理,但是对lua一窍不通。
太谢谢了,解决了我的大难题。

huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 14, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 14, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 15, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 16, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 17, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 18, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 18, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 21, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 21, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 24, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 24, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 24, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 24, 2024
huo-feng-ding added a commit to huo-feng-ding/rime-wubi86-jidian that referenced this issue Oct 29, 2024
@redleafnew
Copy link

我的现在是输入分号后再输入英文,空格上屏了英文,但按回车还带上了分号,有办法回车时也不带分号吗?

@redleafnew
Copy link

想实现的是,平时输入时,编码<4,按回车直接编码上屏。同时按分号临时英文,回车或空格英文上屏,但不包括分号。

@bczhc
Copy link

bczhc commented Oct 30, 2024

我的现在是输入分号后再输入英文,空格上屏了英文,但按回车还带上了分号,有办法回车时也不带分号吗?

如果可以拿lua的话,可以参考 #138 (comment)

@redleafnew
Copy link

redleafnew commented Oct 30, 2024

多谢,用了lua还是不行啊。

@redleafnew
Copy link

redleafnew commented Oct 30, 2024

与我的editor有关吗?

editor:

bindings:

#Return: commit_composition # 回车上屏已经录入内容 改为inline_ascii后回车后会包括分号

#Return: commit_script_text

@redleafnew
Copy link

我所有的配置在这,麻烦大佬给看看:https://www.jianguoyun.com/p/DSL8t1oQ4_OoDBiCs9IFIAA

@bczhc
Copy link

bczhc commented Oct 30, 2024

好像是express_editor的问题,这玩意我没用过。它把按键给拦截掉了,传不到下面的lua_processor了。把临时英文的lua_processor放到express_editor上面就行了。

与我的editor有关吗?

editor:

bindings:

#Return: commit_composition # 回车上屏已经录入内容 改为inline_ascii后回车后会包括分号

#Return: commit_script_text

@redleafnew
Copy link

果然如此,多谢,多谢。
还有一个小的需求,不知道行不行。输入临时英文时,如果里面有点(.),会直接上屏为前面的英文和句号(。),有没有办法保持为点,用于临时输入文件名,如data.docx这样的东西。

@redleafnew
Copy link

还有临时英文中想输入/,结果出来的是顿号

@bczhc
Copy link

bczhc commented Oct 30, 2024

改下recognizer - patterns就好了:english: '^;[a-zA-Z\./]*$'

@redleafnew
Copy link

完美,完美,太感谢了。让您一步步教。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants