gonlpir

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2015 License: GPL-2.0 Imports: 3 Imported by: 2

README

GoNLPIR

Build Status

Introduction

GoNLPIR is a Golang wrapper for the famous Chinese word segmenter NLPIR(former ICTCLAS ) with the following interface implemented:

  • ParagraphProcess
  • ParagraphProcessA
  • ImportUserDict

Install

Get code and install dependences

go get github.com/crackcell/gonlpir
make install_deps
go test -v

Example

package main

import (
    "fmt"
    "github.com/crackcell/gonlpir"
)

func main() {
    n, err := gonlpir.NewNLPIR("../", gonlpir.UTF8, "")
    if err != nil {
        panic(err)
    }
    fmt.Println(n.ParagraphProcess("我是中国人", true))
    fmt.Println(n.ParagraphProcess("我是中国人", false))
    n.Exit()
}

Documents

Misc

Documentation

Index

Constants

View Source
const (
	GBK        = iota // GBK简体中文
	UTF8              // UTF8简体中文
	BIG5              // 台湾大5码
	GBK_FANTI         // GBK繁体中文
	UTF8_FANTI        // UTF8繁体中文
)

Variables

This section is empty.

Functions

func BoolToInt

func BoolToInt(b bool) int

Types

type NLPIR

type NLPIR struct {
	// contains filtered or unexported fields
}

func NewNLPIR

func NewNLPIR(dataPath string, encoding int, licence string) (*NLPIR, error)

func (*NLPIR) Exit

func (this *NLPIR) Exit()

func (*NLPIR) ImportUserDict

func (this *NLPIR) ImportUserDict(fileName string, isOverwrite bool)

func (*NLPIR) ParagraphProcess

func (this *NLPIR) ParagraphProcess(paragraph string, needPosTagged bool) string

func (*NLPIR) ParagraphProcessA

func (this *NLPIR) ParagraphProcessA(paragraph string, useUserDict bool) []*Result

type Result

type Result struct {
	Word     string
	Spos     string
	Ipos     int
	WordId   int
	WordType int
	Weight   int
}

func NewResult

func NewResult() *Result

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL