Skip to content

shogo82148/go-mecab

Repository files navigation

go-mecab

test PkgGoDev

go-mecab is MeCab binding for Golang.

SYNOPSIS

import "github.com/shogo82148/go-mecab"

tagger, err := mecab.New(map[string]string{"output-format-type": "wakati"})
defer tagger.Destroy()
result, err := tagger.Parse("こんにちは世界")
fmt.Println(result)
// Output: こんにちは 世界

INSTALL

You need to tell Go where MeCab has been installed.

$ export CGO_LDFLAGS="-L/path/to/lib -lmecab -lstdc++"
$ export CGO_CFLAGS="-I/path/to/include"
$ go get github.com/shogo82148/go-mecab

If you installed mecab-config, execute following comands.

$ export CGO_LDFLAGS="`mecab-config --libs`"
$ export CGO_CFLAGS="-I`mecab-config --inc-dir`"
$ go get github.com/shogo82148/go-mecab

SEE ALSO