-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathcustom_test.go
29 lines (25 loc) · 1.01 KB
/
custom_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
// Copyright 2015 Benjamin BALET. All rights reserved.
// Use of this source code is governed by the BSD license
// license that can be found in the LICENSE file.
package stopwords
import (
"testing"
)
// TestLoadStopWordsFromFile tries to load a list of stop words from a file
func TestLoadStopWordsFromFile(t *testing.T) {
source := "I will find you across the seas, above the sky long after this life. Indeed, everybody can do that"
expected2 := " seas sky life "
LoadStopWordsFromFile("_stopwords.txt", "en", "\r\n")
actual := CleanString(source, "en", false)
if actual != expected2 {
t.Errorf("Test failed, got: '%s'", actual)
}
//Restore the default stop words of the package
LoadStopWordsFromFile("_english.txt", "en", "\r\n")
source = "She saw a secret little clearing, and a secret little hot made of rustic poles."
expected2 = " saw secret little clearing secret little hot rustic poles "
actual = CleanString(source, "en", false)
if actual != expected2 {
t.Errorf("Test failed, got: '%s'", actual)
}
}