1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-12 13:10:25 +08:00

small refactor, replace WordTagFreq with Entry

This commit is contained in:
Wang Bin
2015-03-25 17:53:25 +08:00
parent 800ecaa8c9
commit 7fe5e7d4c4
4 changed files with 41 additions and 38 deletions

View File

@@ -25,11 +25,11 @@ type Posseg struct {
Flag map[string]string
}
func (p *Posseg) Add(wtf *jiebago.WordTagFreq) {
if len(wtf.Tag) > 0 {
p.Flag[wtf.Word] = strings.TrimSpace(wtf.Tag)
func (p *Posseg) AddEntry(entry *jiebago.Entry) {
if len(entry.Tag) > 0 {
p.Flag[Entry.Word] = strings.TrimSpace(Entry.Flag)
}
p.AddWord(wtf)
p.Add(entry.Word, entry.Freq)
}
// Set dictionary, it could be absolute path of dictionary file, or dictionary