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

updated REAMD.md, fixed a small bug in textrank

This commit is contained in:
Wang Bin
2015-02-28 14:55:32 +08:00
parent c7ac8a7096
commit 142b90f76a
3 changed files with 79 additions and 30 deletions

View File

@@ -157,3 +157,7 @@ func TextRankWithPOS(sentence string, topK int, allowPOS []string) TfIdfs {
func TextRank(sentence string, topK int) TfIdfs {
return TextRankWithPOS(sentence, topK, defaultAllowPOS)
}
func SetDictionary(dictFileName string) error {
return posseg.SetDictionary(dictFileName)
}

View File

@@ -1,7 +1,6 @@
package analyse
import (
"github.com/wangbin/jiebago"
"math"
"testing"
)
@@ -24,9 +23,7 @@ var (
)
func TestTextRank(t *testing.T) {
jiebago.SetDictionary("../dict.txt")
SetIdf("idf.txt")
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 {