Skip to content
/ lua-mecab Public

Lua wrapper for Mecab Japanese morphological analyzer.

Notifications You must be signed in to change notification settings

polm/lua-mecab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lua-mecab

This is a lua wrapper for Mecab. It only supports the Tagger class's parse method, but generally that's all you need.

Install

You can install it with LuaRocks like so:

luarocks install mecab

Alternately build it using the instructions below.

Building

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.

Usage

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("吾輩は猫である"))

License

WTFPL, do as you please.