Exemple #1
0
func split(s string) (ret chan WordItem) {
	ret = make(chan WordItem, 0)
	go func() {
		sc := tier.NewScanner(bufio.NewReader(bytes.NewBufferString(s)), defOpts)
		for sc.Error() == nil {
			sym := sc.Get()
			if sym.Code == tier.Ident {
				w := WordItem{word: strings.ToLower(sym.Value)}
				w.lang = detectLang(w.word)
				if w.lang != "" {
					ret <- w
				}
			}
		}
		close(ret)
	}()
	return
}
Exemple #2
0
func (p *Parser) ConnectTo(rd io.Reader) {
	sc := tier.NewScanner(bufio.NewReader(rd), opts)
	p.r = tier.NewRunner(sc, p)
	//tier.Debug(p.r)
}