1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-23 04:30:44 +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

@@ -15,9 +15,9 @@ type Dictionary struct {
}
// Load loads all tokens from given channel
func (d *Dictionary) Load(ch <-chan dictionary.Token) {
func (d *Dictionary) Load(tokens ...dictionary.Token) {
d.Lock()
for token := range ch {
for _, token := range tokens {
d.addToken(token)
}
d.Unlock()