mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-19 09:50:25 +08:00
优化
This commit is contained in:
4
analyse/tag_extracker.go
Normal file → Executable file
4
analyse/tag_extracker.go
Normal file → Executable file
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/wangbin/jiebago"
|
||||
jiebago "github.com/fumiama/jieba"
|
||||
)
|
||||
|
||||
// Segment represents a word with weight.
|
||||
@@ -74,7 +74,7 @@ func (t *TagExtracter) LoadStopWords(fileName string) error {
|
||||
func (t *TagExtracter) ExtractTags(sentence string, topK int) (tags Segments) {
|
||||
freqMap := make(map[string]float64)
|
||||
|
||||
for w := range t.seg.Cut(sentence, true) {
|
||||
for _, w := range t.seg.Cut(sentence, true) {
|
||||
w = strings.TrimSpace(w)
|
||||
if utf8.RuneCountInString(w) < 2 {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user