1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-27 15:40:32 +08:00

drop chan in DictLoader

This commit is contained in:
源文雨
2022-11-30 13:49:06 +08:00
parent d487545eb5
commit c8785c7994
9 changed files with 786 additions and 790 deletions

View File

@@ -26,10 +26,10 @@ func (i *Idf) AddToken(token dictionary.Token) {
i.Unlock()
}
// Load loads all tokens from channel into it's dictionary.
func (i *Idf) Load(ch <-chan dictionary.Token) {
// Load loads all tokens into it's dictionary.
func (i *Idf) Load(tokens ...dictionary.Token) {
i.Lock()
for token := range ch {
for _, token := range tokens {
i.freqMap[token.Text()] = token.Frequency()
i.freqs = append(i.freqs, token.Frequency())
}