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 }
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 }
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 }
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 }
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 }
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 }