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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user