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

removed unnecessary MarshalBinary/UnmarshalBinary method

This commit is contained in:
Wang Bin
2015-03-16 15:55:41 +08:00
parent 8bf9888a1c
commit 1aabc4a2f3

29
trie.go
View File

@@ -1,7 +1,6 @@
package jiebago
import (
"bytes"
"crypto/md5"
"encoding/gob"
"fmt"
@@ -19,34 +18,6 @@ type trie struct {
Freq map[string]float64
}
func (t trie) MarshalBinary() ([]byte, error) {
var b bytes.Buffer
enc := gob.NewEncoder(&b)
err := enc.Encode(t.Total)
if err != nil {
return nil, err
}
err = enc.Encode(t.Freq)
if err != nil {
return nil, err
}
return b.Bytes(), nil
}
func (t *trie) UnmarshalBinary(data []byte) error {
b := bytes.NewBuffer(data)
dec := gob.NewDecoder(b)
err := dec.Decode(&t.Total)
if err != nil {
return err
}
err = dec.Decode(&t.Freq)
if err != nil {
return err
}
return nil
}
func (t *trie) load(dictFileName string) error {
dictFilePath, err := DictPath(dictFileName)
if err != nil {