1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-05 00:32:51 +08:00
Files
jieba/dictionary/token.go
源文雨 8bbc755ed4 优化
2022-11-30 12:18:15 +08:00

29 lines
580 B
Go
Executable File

package dictionary
// Token represents a Chinese word with (optional) frequency and POS.
type Token struct {
text string
frequency float64
pos string
}
//Text returns token's text.
func (t Token) Text() string {
return t.text
}
// Frequency returns token's frequency.
func (t Token) Frequency() float64 {
return t.frequency
}
// Pos returns token's POS.
func (t Token) Pos() string {
return t.pos
}
// NewToken creates a new token.
func NewToken(text string, frequency float64, pos string) Token {
return Token{text: text, frequency: frequency, pos: pos}
}