1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-05 00:32:51 +08:00

added example_test.go, rename analyse_test.go to tag_extracker_test.go, removed bench.sh

This commit is contained in:
Wang Bin
2015-05-06 15:57:05 +08:00
parent 4e8887da5e
commit f96acf3e85
5 changed files with 24 additions and 5 deletions

22
analyse/example_test.go Normal file
View File

@@ -0,0 +1,22 @@
package analyse_test
import (
"fmt"
"github.com/wangbin/jiebago/analyse"
)
func ExampleExtractTags() {
var t analyse.TagExtracter
t.LoadDictionary("../dict.txt")
t.LoadIdf("idf.txt")
sentence := "这是一个伸手不见五指的黑夜。我叫孙悟空我爱北京我爱Python和C++。"
segments := t.ExtractTags(sentence, 5)
fmt.Printf("Top %d tags:", len(segments))
for _, segment := range segments {
fmt.Printf(" %s /", segment.Text())
}
// Output:
// Top 5 tags: Python / C++ / 伸手不见五指 / 孙悟空 / 黑夜 /
}

View File

@@ -1,3 +1,4 @@
// Package analyse is the Golang implementation of Jieba's analyse module.
package analyse
import (

View File

@@ -1,5 +0,0 @@
#!/bin/sh
go test -run=XXX -v -bench=BenchmarkViterbi -benchtime 10s -benchmem -memprofile viterbi-mem.out -cpuprofile viterbi-cpu.out
go tool pprof -png -output ~/tmp/viterbi-cpu.png posseg.test viterbi-cpu.out
go tool pprof -png -output ~/tmp/viterbi-mem.png posseg.test viterbi-mem.out

View File

@@ -1,3 +1,4 @@
// Package posseg is the Golang implementation of Jieba's posseg module.
package posseg
import (