gommseg is a go wrap for libmmseg: http://www.coreseek.cn/opensource/mmseg/
wget http://www.coreseek.cn/uploads/csft/3.2/mmseg-3.2.14.tar.gz
tar zxvf mmseg-3.2.14.tar.gz
cd mmseg-3.2.14
./bootstrap
./configure
make && make install
cd <GOPATH>/src
git clone https://github.com/hongruiqi/gommseg
cd gommseg
./make.bash
go install
go test -ldflags="-r ."
package main
import (
"fmt"
"gommseg"
)
func main() {
err := mmseg.Init("/usr/local/etc") // path for dict & config file
if err!=nil {
panic(err)
}
segments, err := mmseg.Segment("研究生命起源")
if err!=nil {
panic(err)
}
fmt.Println(segments)
}
go build
then copy libgommseg.so to the system library path.
or
go build -ldflags="r ."
then copy libgommseg.so to the working directory.