Open zmq412 opened 3 weeks ago
// AddToken add a token to the dictionary func (dict *Dictionary) AddToken(token Token) error { ....... dict.totalFreq += token.freq ...... return nil }
// RemoveToken remove token in dictionary func (dict *Dictionary) RemoveToken(token Token) error { bytes := textSliceToBytes(token.text) return dict.trie.Delete(bytes) }
if doing AddToken and RemoveToken a same word repeatedly,the totalFreq will increasingly larger。