mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-05 00:32:51 +08:00
make some public variable/function to private
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user