Shewer Lu
Shewer Lu
> 直接 wrap `map &` 较优。这样就不必中转 table 己修正 lua_template.h 可以return table 了 移除 set_options set_properties
that can eazily create translator from other schema , just add lua_translator@.... lua_api Compoment.Translator will overwrite ticket.schema ```c++ // lua api Ticket ticket(engine, ns); // ticket.schema = engine->schema(); ticket.schema =...
> Why not just write the translator directly? > Why not just write the translator directly? 可以在 script 中對 Phrase 再處理 如 a?cd 產生 aacd abcd accd .... 多個 translation...
先用 librime-lua 止渴 ```lua -- digital.lua # 存入 user_dir/lua -- lua_processor@*digital # 插入 engine/processors/ascii_compose 後 -- local P={} function P.init(env) end function P.fini(env) end function P.func(key,env) local context = env.engine.context...
放在那 ascii_composer?
用 lua_processor@*punctuator ,lua_segmentor@*punctuator lua_translator@*punctuator 三個 component 檢查 property 切換不同方案的punctuator 2 準備多個 方案:/punctuator 利用 context.property 切換 ```lua ------ Processsor function P.init(env) env.puncts={ Component.Processor(env.engine, Schema('punct1'), '', 'punctuator'), Component.Processor(env.engine, Schema('punct2'), '', 'punctuator'), Component.Processor(env.engine,...
看起來開檔很正常,只是沒有字典資料 ,會不會是開錯leveldb 了
LevelDb 要開啟 user_dict db 只能在 offline 操作 translator 使用中的 db , 無法再開啓 LevelDb 會出現錯誤 ,反之也是一樣 當初加入目的是提供librime-lua 可以存取大資料庫 建議 操作 user_dict 用 Memory , ScriptTranslator , TableTranslator 中的 user_dict
[0][./lua/selector.lua:33] → --在 luna_pinyin 沒打開前 測試 luna_pinyin.db [0][./lua/selector.lua:33] → db = LevelDb('luna_pinyin') 7LuaTypeISt10shared_ptrIN4rime2DbEEE: 0x582586df3ec8 [0][./lua/selector.lua:33] → db:open() true [0][./lua/selector.lua:33] → for k,v in db:query(''):iter() do print(k,v) end /db_name luna_pinyin /db_type...
可能找到問題了, librime 1.10 有一次異動 增加 class path 替代 string 最近才修正 lua 的function get_user_data_path() get_shared_data_path() 可能要暫時避開這兩個function https://github.com/hchunhui/librime-lua/pull/365 或是更新 librime-lua 版本