mirror of
https://github.com/fumiama/jieba.git
synced 2026-07-02 10:00:27 +08:00
fix performance problem of extrag_tags, corresponding to jieba commit #eb98eb92484d3d302cd96049be43c224fe45414a
This commit is contained in:
@@ -57,10 +57,10 @@ func ExtractTags(sentence string, topK int) []string {
|
||||
tis := make(TfIdfs, 0)
|
||||
for k, v := range freq {
|
||||
var ti TfIdf
|
||||
if freq_, ok := idfFreq[k]; ok {
|
||||
if freq_, ok := idfLoader.Freq[k]; ok {
|
||||
ti = TfIdf{word: k, freq: freq_ * v}
|
||||
} else {
|
||||
ti = TfIdf{word: k, freq: medianIdf * v}
|
||||
ti = TfIdf{word: k, freq: idfLoader.Median * v}
|
||||
}
|
||||
tis = append(tis, ti)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user