1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-05 00:32:51 +08:00
Files
jieba/dictionary/token.go
2022-11-30 14:14:48 +08:00

29 lines
581 B
Go
Executable File

package dictionary
// Token represents a Chinese word with (optional) frequency and POS.
type Token struct {
frequency float64
text string
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}
}