-
Notifications
You must be signed in to change notification settings - Fork 5
/
LDA_test.go
31 lines (23 loc) · 639 Bytes
/
LDA_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package topics
import (
"testing"
"github.com/stretchr/testify/assert"
)
var docs = []string{
"I like to eat broccoli and bananas.",
"I ate a banana and spinach smoothie for breakfast.",
"Chinchillas and kittens are cute.",
"My sister adopted cute kittens yesterday.",
"Look at this cute hamster munching on a piece of chinchillas.",
}
func Test_LDA(t *testing.T) {
lda := NewLDA(&Configuration{})
corpus := NewCorpus()
processor := NewDefaultProcessor()
processor.AddStrings(corpus, docs)
err := lda.Init(corpus, 2, 0.1, 0.05)
assert.Nil(t, err)
_, err = lda.Train(1000)
assert.Nil(t, err)
lda.PrintTopWords(10)
}