func newMatcher(d *dict, s string) (*matcher, error) { if d.inflator == nil { return nil, errors.New("Dictionary is not loaded") } m := &matcher{ options: defaultMatcherOptions, trie: trie.NewTernaryTrie(), } // Inflate s word, add those to trie. ch := d.inflator.Inflate(s) for w := range ch { m.add(w) } m.trie.Balance() return m, nil }
func New() *Dict { return &Dict{ trie: trie.NewTernaryTrie(), balanced: false, } }
func New() *Matcher { return &Matcher{ trie: trie.NewTernaryTrie(), } }
func New() *Converter { return &Converter{ trie: trie.NewTernaryTrie(), balanced: false, } }