mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-30 09:00:30 +08:00
tweak docs
This commit is contained in:
@@ -20,3 +20,25 @@ func ExampleExtractTags() {
|
|||||||
// Output:
|
// Output:
|
||||||
// Top 5 tags: Python / C++ / 伸手不见五指 / 孙悟空 / 黑夜 /
|
// 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
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
package dictionary
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -8,7 +10,7 @@ import (
|
|||||||
"strings"
|
"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.
|
// tokens from channel.
|
||||||
type DictLoader interface {
|
type DictLoader interface {
|
||||||
Load(<-chan Token)
|
Load(<-chan Token)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package finalseg is the Golang implementation of Jieba's finalseg module.
|
||||||
package finalseg
|
package finalseg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package util contains some util functions used by jiebago.
|
||||||
package util
|
package util
|
||||||
|
|
||||||
import "regexp"
|
import "regexp"
|
||||||
|
|||||||
Reference in New Issue
Block a user