From 8bf9888a1c2a92f2efeb5bcf57bb86d76eec8794 Mon Sep 17 00:00:00 2001 From: Wang Bin Date: Sat, 28 Feb 2015 18:23:59 +0800 Subject: [PATCH] make some public variable/function to private --- analyse/analyse.go | 1 + analyse/textrank.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/analyse/analyse.go b/analyse/analyse.go index 0090725..384dd3b 100644 --- a/analyse/analyse.go +++ b/analyse/analyse.go @@ -35,6 +35,7 @@ func (ws wordWeights) Swap(i, j int) { ws[i], ws[j] = ws[j], ws[i] } +// Keyword extraction. func ExtractTags(sentence string, topK int) (tags wordWeights) { freq := make(map[string]float64) diff --git a/analyse/textrank.go b/analyse/textrank.go index 889308d..21819de 100644 --- a/analyse/textrank.go +++ b/analyse/textrank.go @@ -113,6 +113,8 @@ func (u *undirectWeightedGraph) rank() wordWeights { return result } +// Extract keywords from sentence using TextRank algorithm. the allowed POS list +// could be manually speificed. func TextRankWithPOS(sentence string, topK int, allowPOS []string) wordWeights { posFilt := make(map[string]int) for _, pos := range allowPOS { @@ -152,6 +154,8 @@ func TextRankWithPOS(sentence string, topK int, allowPOS []string) wordWeights { return tags } +// Extract keywords from sentence using TextRank algorithm. +// topK specify how many top keywords to be returned at most. func TextRank(sentence string, topK int) wordWeights { return TextRankWithPOS(sentence, topK, defaultAllowPOS) }