-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.go
More file actions
44 lines (36 loc) · 1019 Bytes
/
test.go
File metadata and controls
44 lines (36 loc) · 1019 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
package brain
import (
"fmt"
"testing"
)
func TestAdd(t *testing.T) {
// Example of using loadConfig and normalizeSentence
configPath := "config.json"
config, err := loadConfig(configPath)
println(config)
if err != nil {
panic(err)
}
// Example usage of normalizeSentence
sentence := "Example sentence to normalize!"
normalized := normalizeSentence(sentence)
println(normalized)
// Example usage
tokenizer, err := LoadTokenizer("/path/to", "tokenizer.json")
if err != nil {
// Handle error
panic(err)
}
// Use the tokenizer
// For example, print the tokenizer data
fmt.Printf("Loaded tokenizer: %+v\n", tokenizer)
fileName := "data"
stemmer, punctReEscape, unknowns, path := setConfig(fileName)
fmt.Println(stemmer, punctReEscape, unknowns, path)
stemmer = NewStemmer()
words := []string{"berjalan", "menggunakan", "pengetahuan", "terapkan"}
for _, word := range words {
stemmedWord := stemmer.Stem(word)
fmt.Printf("Original: %-12s Stemmed: %-12s\n", word, stemmedWord)
}
}