1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-18 00:50:26 +08:00

unify Cut method, return channel instead of array

This commit is contained in:
Wang Bin
2015-02-27 17:04:50 +08:00
parent 76b9df8511
commit d76fbfb017
3 changed files with 43 additions and 29 deletions

View File

@@ -123,7 +123,10 @@ func TextRankWithPOS(sentence string, topK int, allowPOS []string) TfIdfs {
g := newUndirectWeightedGraph()
cm := make(map[[2]string]float64)
span := 5
wordTags := posseg.Cut(sentence, true)
wordTags := make([]posseg.WordTag, 0)
for wordTag := range posseg.Cut(sentence, true) {
wordTags = append(wordTags, wordTag)
}
for i, _ := range wordTags {
if _, ok := posFilt[wordTags[i].Tag]; ok {
for j := i + 1; j < i+span; j++ {