1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-21 11:20:31 +08:00

make some public variable/function to private

This commit is contained in:
Wang Bin
2015-02-28 18:17:48 +08:00
parent d06ba85b0b
commit 1c8d4fbf23
4 changed files with 65 additions and 65 deletions

View File

@@ -8,17 +8,17 @@ import (
var (
sentence = "此外公司拟对全资子公司吉林欧亚置业有限公司增资4.3亿元增资后吉林欧亚置业注册资本由7000万元增加到5亿元。吉林欧亚置业主要经营范围为房地产开发及百货零售等业务。目前在建吉林欧亚城市商业综合体项目。2013年实现营业收入0万元实现净利润-139.13万元。"
tagRanks = TfIdfs{
TfIdf{Word: "吉林", Freq: 1.0},
TfIdf{Word: "欧亚", Freq: 0.87807810644},
TfIdf{Word: "置业", Freq: 0.562048250306},
TfIdf{Word: "实现", Freq: 0.520905743929},
TfIdf{Word: "收入", Freq: 0.384283870648},
TfIdf{Word: "增资", Freq: 0.360590945312},
TfIdf{Word: "子公司", Freq: 0.353131980904},
TfIdf{Word: "城市", Freq: 0.307509449283},
TfIdf{Word: "全资", Freq: 0.306324426665},
TfIdf{Word: "商业", Freq: 0.306138241063},
tagRanks = wordWeights{
wordWeight{Word: "吉林", Weight: 1.0},
wordWeight{Word: "欧亚", Weight: 0.87807810644},
wordWeight{Word: "置业", Weight: 0.562048250306},
wordWeight{Word: "实现", Weight: 0.520905743929},
wordWeight{Word: "收入", Weight: 0.384283870648},
wordWeight{Word: "增资", Weight: 0.360590945312},
wordWeight{Word: "子公司", Weight: 0.353131980904},
wordWeight{Word: "城市", Weight: 0.307509449283},
wordWeight{Word: "全资", Weight: 0.306324426665},
wordWeight{Word: "商业", Weight: 0.306138241063},
}
)
@@ -26,7 +26,7 @@ func TestTextRank(t *testing.T) {
SetDictionary("../dict.txt")
results := TextRank(sentence, 10)
for index, tw := range results {
if tw.Word != tagRanks[index].Word || math.Abs(tw.Freq-tagRanks[index].Freq) > 1e-6 {
if tw.Word != tagRanks[index].Word || math.Abs(tw.Weight-tagRanks[index].Weight) > 1e-6 {
t.Errorf("%v != %v", tw, tagRanks[index])
}
}