-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathspellchecking_lemma_test.go
49 lines (38 loc) · 1.12 KB
/
spellchecking_lemma_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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package lemmingo_test
import (
"fmt"
"github.com/smileart/lemmingo"
)
func ExampleLemmaWithSpellcheckingOnly() {
var l string
var ok bool
var err error
lem, err := lemmingo.New("./en.lmm", "en", "freeling", false, true, false)
if err != nil {
panic(err)
}
// NOTICE: ONLY in case when the spellchecker is turned on, but stemmer is not
// we get the original word spellchecked instead of the stemmer results!
l, ok, err = lem.Lemma("teeenager", "NOUN")
fmt.Println(l, ok, err)
l, ok, err = lem.Lemma("bubling", "VERB")
fmt.Println(l, ok, err)
l, ok, err = lem.Lemma("lovinh", "VERB")
fmt.Println(l, ok, err)
l, ok, err = lem.Lemma("loveing", "VERB")
fmt.Println(l, ok, err)
l, ok, err = lem.Lemma("typo", "NOUN")
fmt.Println(l, ok, err)
l, ok, err = lem.Lemma("juse", "NOUN")
fmt.Println(l, ok, err)
l, ok, err = lem.Lemma("abracadabrated", "ADJ")
fmt.Println(l, ok, err)
// Output:
// teenager true <nil>
// bubble true <nil>
// love true <nil>
// love true <nil>
// typo true <nil>
// Jude false Word's (Jude) lemma wasn't found!
// abracadabra ted false Word's (abracadabra ted) lemma wasn't found!
}