Skip to content

hongruiqi/gommseg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gommseg

Description

gommseg is a go wrap for libmmseg: http://www.coreseek.cn/opensource/mmseg/

Installation

Compile & Install libmmseg

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

Generate libgommseg.so (C wrap for libmmseg)

cd <GOPATH>/src
git clone https://github.com/hongruiqi/gommseg
cd gommseg
./make.bash

Compile && Install gommseg

go install

Test

go test -ldflags="-r ."

Usage

Example

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)
}

Compile

go build

then copy libgommseg.so to the system library path.

or

go build -ldflags="r ."

then copy libgommseg.so to the working directory.

License

MIT: http://www.opensource.org/licenses/mit-license.php

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published