Documentation ¶
Index ¶
- Constants
- func GetKeysId(keywords ...string) (id uint64)
- func LoadEmitProb()
- func PartToStrings(part []*Part, tag int) (output string)
- func PartToTexts(part []*Part) (output []string)
- func Reverse(s string) string
- func ToLower(text []byte) []byte
- func Viterbi(obs []rune, states []byte) (float64, []byte)
- type Dictionary
- type EmoDictionary
- type EmoWord
- type Emotion
- type Hmm
- type MMseg
- type Node
- type OpRet
- type OptionalVal
- type OutPut
- type Part
- type Parter
- func (pr *Parter) Dictionary() *Dictionary
- func (pr *Parter) DoPartWords(text string, partModel int) []*Part
- func (pr *Parter) LoadDictionary(dictfiles string)
- func (pr *Parter) LoadEmoDictionary(dictfiles string)
- func (pr *Parter) Part(text string, partModel int, tag int) *OutPut
- func (pr *Parter) PartWords(text string, partModel int, tag int) string
- func (pr *Parter) PartWordsTexts(text string, partModel int) []string
- type Text
- type Trie
- func (t *Trie) AddKey(key string, meta interface{}) *Node
- func (t *Trie) FindKey(key string) (*Node, bool)
- func (t *Trie) HasKey(key string) bool
- func (t *Trie) RemoveKey(key string)
- func (t *Trie) Root() *Node
- func (t *Trie) SearchKeyByPre(pre string) []string
- func (t *Trie) SearchKeyByPre2Next(pre, next string) (string, bool)
- func (t *Trie) SearchKeyNodeByPre2Next(pre, next string) (string, bool)
- type Word
Constants ¶
View Source
const ( EMO_VAL_DEFAULT = 0 //词情感值,默认值 EMO_VAL_ONE = 2 //词情感值,积极词的前一词为程度副词, EMO_VAL_TWO = 1 //词情感值,积极词的前后词什么都不是,消极词的前一词为否定词 EMO_VAL_THREE = -0.5 //词情感值,否定词 EMO_VAL_FOUR = -1 //词情感值,积极词的前一词为否定词、消极词,后一词为消极词,消极词的前一次什么都不是 EMO_VAL_FIVE = -2 //词情感值,消极词的前一词为程度副词 )
View Source
const ( TAG_VAL_ZERO = 0 //不显示词其他信息 TAG_VAL_ONE = 1 //显示词典中的词性 TAG_VAL_TWO = 2 //显示词的词频,distance TAG_VAL_THREE = 3 //显示词的情感词性,积极词(po),否定词(ga),消极词(ne),程度副词(de),主张词(cl),无词性(x)。 )
View Source
const ( PART_MODE_ONE = 1 //普通分词 PART_MODE_TWO = 2 //mmseg分词 PART_MODE_THREE = 3 //隐马尔可夫模型分词 )
View Source
const MIN_FLOAT = -3.14e100
View Source
const MIN_WORD_FREQUENCY = 2
View Source
const SPACE = 32
Variables ¶
This section is empty.
Functions ¶
func LoadEmitProb ¶
func LoadEmitProb()
func PartToStrings ¶
字符串显示分词 (老方法保留) tag 0 不显示词其他信息 tag 1 显示词的词性 tag 2 显示词的词频,distance
Types ¶
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
分词字典
func NewDictionary ¶
func NewDictionary() *Dictionary
func (*Dictionary) AddWord ¶
func (dict *Dictionary) AddWord(word *Word)
func (*Dictionary) MaxCharLen ¶
func (dict *Dictionary) MaxCharLen() int
func (*Dictionary) TotalRate ¶
func (dict *Dictionary) TotalRate() int64
func (*Dictionary) Trie ¶
func (dict *Dictionary) Trie() *Trie
func (*Dictionary) WordsNum ¶
func (dict *Dictionary) WordsNum() int
type EmoDictionary ¶
type EmoDictionary struct {
// contains filtered or unexported fields
}
情感词典
func NewEmoDictionary ¶
func NewEmoDictionary() *EmoDictionary
type Hmm ¶
type Hmm struct {
// contains filtered or unexported fields
}
func (*Hmm) GetViterbiResult ¶
type MMseg ¶
type MMseg struct {
// contains filtered or unexported fields
}
func NewMMsge ¶
func NewMMsge(chars []rune, dict *Dictionary) *MMseg
func (*MMseg) FilterByMMsegRules ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) RemoveChild ¶
type OptionalVal ¶
type OptionalVal func(*Word) //可参数值
func Pos ¶
func Pos(pos string) OptionalVal
func Rate ¶
func Rate(rate int) OptionalVal
type OutPut ¶
type OutPut struct {
// contains filtered or unexported fields
}
func (*OutPut) EmotionLabel ¶
给分词加情感词性标注
type Parter ¶
type Parter struct {
// contains filtered or unexported fields
}
npartword分词器
func (*Parter) Dictionary ¶
func (pr *Parter) Dictionary() *Dictionary
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.