shewer / librime-lua-script

57 stars 6 forks source link

请教如何配置到方案中 #2

Open chzhsh opened 2 years ago

chzhsh commented 2 years ago

如题。看了看.md文档没能理解透彻,大大有配置好的方案可以分享吗?

shewer commented 2 years ago

我已經更新說明,你可以看一下 #安裝 建議一個一個模組 enable 測試

zhuangzhemin commented 2 years ago

方便给一个完整rime配置的压缩包吗?我按说明设置了,但是没有起作用。有完整包的话可以研究下是哪里设置有差异。谢谢!

shewer commented 2 years ago

你的librime-lua 版本是?? 請確認是否安裝librime-lua 的plug-in 如果有 安裝此套件 可以用 "/ver " commit 會輸出 librime-lua 版本 要>#127 ex : Version: Lua 5.4 librime-lua Version: 147

安裝 應該不難 有plum 用plum 手動設定yaml 也只要把 在方案 custom.yaml 加上 一 行 __include: processor_plugin:/patch

rime.lua 加上

init_processor= require("init_processor")

zhuangzhemin commented 2 years ago

感谢您的及时回复。请教下“/ver”的完整命令是?

我的操作方式如下。还请指正。谢谢!

  1. 从https://github.com/rime/weasel/releases下载安装weasel

  2. 从https://github.com/shewer/librime-lua/releases下载补丁

  3. 然后“退出算法服务”

  4. 把rime\dist\bin\rime_patch.exe文件复制到D:\Programs\Rime\weasel-0.14.3目录,双击执行

  5. 复制rime\dist\lib\rime.lib和rime\dist\lib\rime.dll到D:\Programs\Rime\weasel-0.14.3目录

  6. 执行这部分操作: git clone https://github.com/shewer/librime-lua-script --depth=1 mv librime-lua-script/lua/* ./lua cp libryme-lua-script/processor_plugin.yaml . cp librime-lua-script/example/essay-zh-hans.txt .

    -- append rime.lua init_processor= require('init_processor')

    custom.yaml

    patch: __include: processor_plugin:/patch

  7. 重启算法服务

  8. 重新部署

shewer commented 2 years ago

檔案己拷背完整? yaml 縮排

patch:
   __include: processor_plugin:/patch

在中文模式下 輸入 /ver 空白鍵 會輸出 版本字串

查看 log 方法 https://github.com/hchunhui/librime-lua/issues/129

zhuangzhemin commented 2 years ago

我输入/ver+没有显示版本信息。用了我自己定义的小鹤双拼、仓颉5、明月拼音,都不行。.custom.yamk文件会起作用,能看到各种switch选项有显示出来。 看上去是rime lua出错了。log文件信息如下: Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg E0317 21:08:12.546973 7320 lua_gears.cc:44] Lua Compoment of module1 initialize error:(2): D:\Home\Rime\lua\init_processor.lua:143: attempt to index a function value (field 'module') E0317 21:08:12.577093 7320 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:08:12.608356 7320 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:08:12.993551 7320 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:08:13.024837 7320 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:08:14.011546 7320 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:08:14.064371 7320 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:08:17.400521 15932 lua_gears.cc:44] Lua Compoment of module1 initialize error:(2): D:\Home\Rime\lua\init_processor.lua:143: attempt to index a function value (field 'module') E0317 21:08:23.214535 15932 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:18.650614 5164 lua_gears.cc:44] Lua Compoment of module1 initialize error:(2): D:\Home\Rime\lua\init_processor.lua:143: attempt to index a function value (field 'module') E0317 21:09:18.746711 5164 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:23.998896 11896 lua_gears.cc:44] Lua Compoment of module1 initialize error:(2): D:\Home\Rime\lua\init_processor.lua:143: attempt to index a function value (field 'module') E0317 21:09:24.000921 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:24.110924 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:24.148041 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:24.281652 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:25.101990 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:25.181429 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:25.266865 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:25.340054 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:25.732457 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:25.886165 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:43.351598 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:43.437702 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:43.534776 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:44.559298 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.057960 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.087998 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.122153 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.153398 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.186156 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.217412 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.248661 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.286417 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.317677 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.348927 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.386683 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.417943 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.449684 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.486943 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.518199 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module') E0317 21:09:45.549448 11896 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module')

https://github.com/sdadonkey/rime-english 这个lua英文输入版本可以使用,不过那是在ASCII Mode下的,也没有词语联想输入功能。

非常感谢。

shewer commented 2 years ago

https://github.com/shewer/librime-lua-script/blob/bdfcb0790ae42a3d07095de324ca00adcbe724fd/lua/init_processor.lua#L143 看起來像是 module1 找不到

# processor_plugin
module1:
   modules:
            .... 

沒有引入 可以檢查 build/<方案>.schema.yaml 有沒有把 processor_plugin:/module1 加截入方案中

zhuangzhemin commented 2 years ago

我把小狼毫重装了一下,避免以前安装其它版本的rime.dll或者其它文件导致的问题。 重新安装并且打上https://github.com/shewer/librime-lua/releases 这里的补丁后,现在中文输入“/ver "是可以显示版本信息如下: "Version: Lua 5.4 librime-lua Version: 127"

build/<方案>.schema.yaml有"lua_processor@init_processor@module1"的信息: engine: filters:

Rime Log还是报错如下: Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg E0317 23:21:01.724162 16732 lua_gears.cc:44] Lua Compoment of module1 initialize error:(2): D:\Home\Rime\lua\init_processor.lua:143: attempt to index a function value (field 'module') E0317 23:21:01.771028 16732 lua_gears.cc:167] LuaProcessor::ProcessKeyEvent of module1 error(2): D:\Home\Rime\lua\init_processor.lua:194: attempt to index a function value (field 'module')

shewer commented 2 years ago

檢查 build/ 方案.schema.yaml 是否有

module1:
    modules:
         ....
zhuangzhemin commented 2 years ago

有的: menu: page_size: 10 module1: modules:

zhuangzhemin commented 2 years ago

学会怎么在回复时显示正确的代码缩进了:)

menu:
  page_size: 10
module1:
  modules:
    - {module: command, module_name: cammand_proc, name_space: command}
    - {module: english, module_name: english_proc, name_space: english}
punctuator:
  full_shape:
    " ": {commit: " "}
    "!": {commit: "!"}
shewer commented 2 years ago

lua/ 檔案清單 我試着在win10 新裝 librime-lua-script ( 移開 lua/ 以librime-lua-script/lua 取代)

tree lua:

lua
├── command
│   ├── command_str.lua
│   └── init.lua
├── component
│   ├── select_character.lua
│   ├── unicode.lua
│   └── uniquifier.lua
├── conjunctive.lua
├── english
│   ├── english1.txt
│   ├── english.dict.xlsx
│   ├── english_plugin.yaml
│   ├── english_tran.lua
│   ├── english_tw.txt
│   ├── english.txt
│   ├── ext_dict.txt
│   ├── init.lua
│   ├── Makefile
│   ├── README.md
│   └── rime.lua
├── english.lua  <------   這個   和  english/init.lua 衝突
├── init_processor.lua
├── multi_reverse
│   ├── completion.lua
│   ├── init.lua
│   ├── keybind_cfg.lua
│   ├── mfilter.lua
│   ├── multiswitch.lua
│   └── README.md
├── test
│   ├── init.lua
│   ├── list_test.lua
│   ├── multiswitch_test.lua
│   ├── object_test.lua
│   └── pattern_test.lua
└── tools
    ├── debugtool.lua
    ├── dict.lua
    ├── english_dict.lua
    ├── english_tw.txt
    ├── inspect.lua
    ├── json.lua
    ├── key_binder.lua
    ├── list.lua
    ├── luaunit.lua
    ├── meta_string.lua
    ├── metatable.lua
    ├── object.lua
    ├── object_new.lua
    ├── pattern.lua
    ├── README.md
    ├── rime_api.lua
    ├── string.lua
    ├── wordninja.lua
    └── wordninja_words.txt

6 directories, 49 files
zhuangzhemin commented 2 years ago

tree lua:

lua
├── command
│   ├── command_str.lua
│   └── init.lua
├── component
│   ├── select_character.lua
│   ├── unicode.lua
│   └── uniquifier.lua
├── conjunctive.lua
├── english
│   ├── english1.txt
│   ├── english.dict.xlsx
│   ├── english_plugin.yaml
│   ├── english_tran.lua
│   ├── english_tw.txt
│   ├── english.txt
│   ├── ext_dict.txt
│   ├── init.lua
│   ├── Makefile
│   ├── README.md
│   └── rime.lua
├── english.lua
├── init_processor.lua
├── multi_reverse
│   ├── completion.lua
│   ├── init.lua
│   ├── keybind_cfg.lua
│   ├── mfilter.lua
│   ├── multiswitch.lua
│   └── README.md
├── test
│   ├── init.lua
│   ├── list_test.lua
│   ├── multiswitch_test.lua
│   ├── object_test.lua
│   └── pattern_test.lua
└── tools
    ├── debugtool.lua
    ├── dict.lua
    ├── english_dict.lua
    ├── english_tw.txt
    ├── inspect.lua
    ├── json.lua
    ├── key_binder.lua
    ├── list.lua
    ├── luaunit.lua
    ├── meta_string.lua
    ├── metatable.lua
    ├── object.lua
    ├── object_new.lua
    ├── pattern.lua
    ├── README.md
    ├── rime_api.lua
    ├── string.lua
    ├── wordninja.lua
    └── wordninja_words.txt

6 directories, 49 files
shewer commented 2 years ago

我晚上在win10 重裝( 移開 lua 把 librime-lua-script/lua copy to lua) 也就 兩改兩個檔 各 加入一行 rime.lua : require i'nit_processor' < 方案>.custom.yaml __include: .... 放入 patch 下

zhuangzhemin commented 2 years ago

破案了,是我这里lua/english目录和lua/english.lua这两个冲突了。lua/english.lua来自另外一个输入法。我把english.lua改名字,就可以正常使用了。非常感谢您的宝贵时间。

lua
├── english
│   ├── english1.txt
│   ├── english.dict.xlsx
│   ├── english_plugin.yaml
│   ├── english_tran.lua
│   ├── english_tw.txt
│   ├── english.txt
│   ├── ext_dict.txt
│   ├── init.lua
│   ├── Makefile
│   ├── README.md
│   └── rime.lua
├── english.lua
zhuangzhemin commented 2 years ago

方便给一个完整rime配置的压缩包吗?我按说明设置了,但是没有起作用。有完整包的话可以研究下是哪里设置有差异。谢谢!

我在shewer的帮助下把这套lua插件按自己的需求配置好了。完整的配置文件(小鹤音形+中文Wiki词库+lua英文输入插件+Android端配置)更新到https://github.com/zhuangzhemin/rime,其他有需要的rime友可以相互参考

我安装librime-lua补丁的过程如下:

  1. https://github.com/rime/weasel/releases下载安装weasel
  2. https://github.com/shewer/librime-lua/releases下载补丁
  3. 然后“退出算法服务”
  4. 把rime\dist\bin\rime_patch.exe文件复制到D:\Programs\Rime\weasel-0.14.3目录,双击执行
  5. 复制rime\dist\lib\rime.lib和rime\dist\lib\rime.dll到D:\Programs\Rime\weasel-0.14.3目录
  6. 重启算法服务
  7. 重新部署