This is a lua wrapper for Mecab. It only
supports the Tagger
class's parse
method, but generally that's all you
need.
You can install it with LuaRocks like so:
luarocks install mecab
Alternately build it using the instructions below.
Build with make
.
The Makefile
assumes libmecab.so
can be found in /usr/lib
; if it's somewhere else call make like so:
make MECAB_SO=/path/to/libmecab.so
and you should be fine.
Copy the lua-mecab.so
file to your lua project and then use it like this:
mecab = require "mecab" -- if you build it yourself, use the .so name (lua-mecab) here
parser = mecab:new("") -- you can pass mecab config options here, like "-Owakati"
print(parser:parse("吾輩は猫である"))
WTFPL, do as you please.