when read through the whole set of quote rows before beginning adding back into the babbler

This commit is contained in:
skkiesel 2017-05-10 09:50:37 -04:00
parent f28dabf0ba
commit 24f373d20f
1 changed files with 6 additions and 0 deletions

View File

@ -141,13 +141,19 @@ func (p *BabblerPlugin) getOrCreateBabbler(babbler string) (int64, error) {
//we'll just ignore this but the actual creation succeeded previously
return id, nil
}
defer rows.Close()
tidbits := []string{}
for rows.Next() {
var tidbit string
err := rows.Scan(&tidbit)
if err != nil {
return id, err
}
tidbits = append(tidbits, tidbit)
}
for _, tidbit := range tidbits {
p.addToMarkovChain(id, tidbit)
}