本文整理匯總了Golang中github.com/johnmcconnell/gologspace.Space類的典型用法代碼示例。如果您正苦於以下問題:Golang Space類的具體用法?Golang Space怎麽用?Golang Space使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Space類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Initial
func (c *Config) Initial(s gologspace.Space) hmm.Initial {
e := hmm.Initial{}
for tag, p := range c.I {
e[tag] = s.Enter(p)
}
return e
}
示例2: UniformI
func UniformI(tags []Tag, s gologspace.Space) Initial {
iS := make(Initial)
length := float64(len(tags))
size := s.Enter(length)
one := s.Enter(1.0)
for _, tag := range tags {
iS[tag] = one / size
}
return iS
}
示例3: Emission
func (c *Config) Emission(s gologspace.Space) hmm.Emission {
e := hmm.Emission{}
for tag, probs := range c.E {
p := make(map[string]float64)
for word, prob := range probs {
p[word] = s.Enter(prob)
}
e[tag] = p
}
return e
}
示例4: Transition
func (c *Config) Transition(s gologspace.Space) hmm.Transition {
e := hmm.Transition{}
for tag1, probs := range c.T {
p := make(map[hmm.Tag]float64)
for tag2, prob := range probs {
p[tag2] = s.Enter(prob)
}
e[tag1] = p
}
return e
}
示例5: UniformT2
func UniformT2(tags TCache, s gologspace.Space) Transition {
t := make(Transition)
one := s.Enter(1.0)
for tag1, nTags := range tags {
t[tag1] = make(map[Tag]float64)
length := float64(len(nTags))
size := s.Enter(length)
for tag2, _ := range nTags {
t[tag1][tag2] = one / size
}
}
return t
}
示例6: UniformT
func UniformT(tags []Tag, s gologspace.Space) Transition {
t := make(Transition)
length := float64(len(tags))
size := s.Enter(length)
one := s.Enter(1.0)
for _, tag1 := range tags {
t[tag1] = make(map[Tag]float64)
for _, tag2 := range tags {
t[tag1][tag2] = one / size
}
}
return t
}
示例7: FormatString
// String ...
func (r *Result) FormatString(s gologspace.Space) string {
p := s.Exit(r.Prob)
return fmt.Sprintf("'%v': %.8fp|", r.prevTag, p)
}