BlindingDark / rime-easy-en

Rime / Easy English 英文输入法
GNU Lesser General Public License v3.0
286 stars 25 forks source link

add wordninja_lua module #33

Open shewer opened 2 years ago

shewer commented 2 years ago

Signed-off-by: Shewer Lu shewer@gmail.com 從 shell調用wordninja 非常浪費 因爲 每次都要載入 wordninja_words.txt 且 重算權重

建議

-- <user_data_dir>/lua/plugin/?.(so|dylib|dll) 加入 package.cpath
local function init_cpath()
  local path= ("./lua/plugin/"):gsub("/",package.config:sub(1,1) )
  local pattern = path:gsub("([.?/%\\])","%%%1")
  --  pattern --> "%.%/lua%/plugin%/"  or "%.%\\lua%\\plugin%\\"
  if not package.cpath:match( pattern ) then
    local cp=package.cpath
    local df= cp:match('?.so') or cp:match('?.dylib') or cp:match('?.dll')
    package.cpath= package.cpath .. (df and ";" .. path .. df or "")
  end
end