mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-05 00:32:51 +08:00
优化
This commit is contained in:
2
analyse/example_test.go
Normal file → Executable file
2
analyse/example_test.go
Normal file → Executable file
@@ -3,7 +3,7 @@ package analyse_test
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/wangbin/jiebago/analyse"
|
||||
"github.com/fumiama/jieba/analyse"
|
||||
)
|
||||
|
||||
func Example_extractTags() {
|
||||
|
||||
2
analyse/idf.go
Normal file → Executable file
2
analyse/idf.go
Normal file → Executable file
@@ -4,7 +4,7 @@ import (
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"github.com/wangbin/jiebago/dictionary"
|
||||
"github.com/fumiama/jieba/dictionary"
|
||||
)
|
||||
|
||||
// Idf represents a thread-safe dictionary for all words with their
|
||||
|
||||
0
analyse/idf.txt
Normal file → Executable file
0
analyse/idf.txt
Normal file → Executable file
0
analyse/stop_words.txt
Normal file → Executable file
0
analyse/stop_words.txt
Normal file → Executable file
2
analyse/stopwords.go
Normal file → Executable file
2
analyse/stopwords.go
Normal file → Executable file
@@ -3,7 +3,7 @@ package analyse
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/wangbin/jiebago/dictionary"
|
||||
"github.com/fumiama/jieba/dictionary"
|
||||
)
|
||||
|
||||
// DefaultStopWordMap contains some stop words.
|
||||
|
||||
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
|
||||
|
||||
0
analyse/tag_extracker_test.go
Normal file → Executable file
0
analyse/tag_extracker_test.go
Normal file → Executable file
2
analyse/textrank.go
Normal file → Executable file
2
analyse/textrank.go
Normal file → Executable file
@@ -4,7 +4,7 @@ import (
|
||||
"math"
|
||||
"sort"
|
||||
|
||||
"github.com/wangbin/jiebago/posseg"
|
||||
"github.com/fumiama/jieba/posseg"
|
||||
)
|
||||
|
||||
const dampingFactor = 0.85
|
||||
|
||||
0
analyse/textrank_test.go
Normal file → Executable file
0
analyse/textrank_test.go
Normal file → Executable file
Reference in New Issue
Block a user