Prose 是一款用于Go 语言的文本处理库(主要是英文),支持 okenization(分词)、part-of-speech tagging(词性标注)、named-entity extraction(命名实体提取)等。
安装
$ go get github.com/jdkato/prose/...
使用
Tokenizing
单词、句子和 regexp tokenizer 可用。 每个分词器实现相同的接口,这样可以轻松地在库的其他部分中自定义词语切分。
package main
import (
"fmt"
"github.com/jdkato/prose/tokenize"
)
func main() {
text := "They'll save and invest more."
tokenizer := tokenize.NewTreebankWordTokenizer()
for _, word := range tokenizer.Tokenize(text) {
// [They 'll save and invest more .]
fmt.Println(word)
}
}
