1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-08 18:40:24 +08:00

tweak docs

This commit is contained in:
Wang Bin
2015-05-06 16:11:11 +08:00
parent f96acf3e85
commit b3ea94ba47
4 changed files with 27 additions and 1 deletions

View File

@@ -20,3 +20,25 @@ func ExampleExtractTags() {
// Output:
// Top 5 tags: Python / C++ / 伸手不见五指 / 孙悟空 / 黑夜 /
}
func ExampleTextRank() {
var t analyse.TextRanker
t.LoadDictionary("../dict.txt")
sentence := "此外公司拟对全资子公司吉林欧亚置业有限公司增资4.3亿元增资后吉林欧亚置业注册资本由7000万元增加到5亿元。吉林欧亚置业主要经营范围为房地产开发及百货零售等业务。目前在建吉林欧亚城市商业综合体项目。2013年实现营业收入0万元实现净利润-139.13万元。"
result := t.TextRank(sentence, 10)
for _, segment := range result {
fmt.Printf("%s %f\n", segment.Text(), segment.Weight())
}
// Output:
// 吉林 1.000000
// 欧亚 0.878078
// 置业 0.562048
// 实现 0.520906
// 收入 0.384284
// 增资 0.360591
// 子公司 0.353132
// 城市 0.307509
// 全资 0.306324
// 商业 0.306138
}

View File

@@ -1,3 +1,5 @@
// Package dictionary contains a interface and wraps all io related work.
// It is used by jiebago module to read/write files.
package dictionary
import (
@@ -8,7 +10,7 @@ import (
"strings"
)
// DictLoader represents a interface that could add one token or load bunch of
// DictLoader is the interface that could add one token or load
// tokens from channel.
type DictLoader interface {
Load(<-chan Token)

View File

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

View File

@@ -1,3 +1,4 @@
// Package util contains some util functions used by jiebago.
package util
import "regexp"