1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-05 00:32:51 +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
}