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

求教:如何在 charset 脚本中实现过滤 CJK 扩展汉字的同时保留 Emoticons #241

Open
ChihSee-Hsie opened this issue Apr 16, 2023 · 8 comments

Comments

@ChihSee-Hsie
Copy link

如题,在现有的 charset 脚本中,似乎没有这样的功能。

@ChihSee-Hsie
Copy link
Author

ChihSee-Hsie commented Apr 16, 2023

我尝试阅读代码(没有这个基础),猜测是帮助函数中的 exists(single_filter, text) 要求单字造成的问题,但我不确定。将这个函数删除之后,程序不能正常工作。

@mokapsing
Copy link

你应该想想怎么用lua脚本实现,而不是去增删本项目源码

@shewer
Copy link
Contributor

shewer commented Apr 17, 2023

爲何不把simplifier@emoji_suggestion 排在 charset_filter 後

@ChihSee-Hsie
Copy link
Author

感谢!我之前的 simplifier@emoji_suggestion 是排在最前面的,现在移到后面果然有效果了——也就是说 filter 的书写顺序也是执行顺序?

@shewer
Copy link
Contributor

shewer commented Apr 17, 2023

processors segmentors filters 有順序
tarnslators 好像有用 MergedTranslation 會重排序 candidate 權重

@ChihSee-Hsie
Copy link
Author

ChihSee-Hsie commented Apr 17, 2023

如果我希望使用 options 控制方案使用不同的滤镜,这时在方案中应该怎样配置呢?是写两个函数,利用 options 分别调用吗?

在 librime 1.7.3 with plugin 中,可以直接调用 charset_filter@gbk+emoji 实现将字符集控制在 GBK 的同时又能使用 emoticons 的功能,这时的切换方法如下:

- options: [gbk+emoji, utf8]
  states:
    - GBK
    - UTF-8
  reset: 0

最新的 librime 没有包含这个插件,我也不熟悉 lua,这也是我一直没有更新 librime 的原因。

@shewer
Copy link
Contributor

shewer commented Apr 17, 2023

應該不影響
覺得是方案設定問題
charset_filter@gbk+emoji name_space: gbk+emoji

  • options: [ gbk+emoji, utf8] --> option_name gbk+emoji and utf8
    states: switches 目錄顯示字串
    reset: 0 : 預設 gbk+emoji :true

@ChihSee-Hsie
Copy link
Author

其实我还是不太理解这里的切换是怎样设定的……比如我现在使用了 lua_filter@CJK,但有时又需要扩展字库,那么怎样将它关掉呢?我尝试写了如下配置:

switches:
  ...
  - options: [CJK, utf8]
    states:
      - CJK
      - UTF-8
    reset: 0

......

CJK:
  option_name: CJK

但是没有任何效果。

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