-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnormalizer_test.go
More file actions
38 lines (31 loc) · 1.44 KB
/
normalizer_test.go
File metadata and controls
38 lines (31 loc) · 1.44 KB
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
package dajareGo
import "testing"
type testcase struct {
input string
expect string
}
func TestPreNormalizer(t *testing.T) {
testcases := [...]testcase{
// replace characters that like two or more occurrences of Japanese Prolonged Sound Mark "ー"
{"ずーーーーーーしーーーーーーほっきーーー--", "ずーしーほっきー"},
// Delete heading Hankaku Space and tailing Hankaku Space
{" ほげほげ", "ほげほげ"},
{"ほげほげ ", "ほげほげ"},
// Delete Hankaku Space among Hiragana, Katakana, and Kanji
{"情報 表現 入門 の 教科書 を 買い ました", "情報表現入門の教科書を買いました"},
{"Introduction to Information Expression", "Introduction to Information Expression"},
// Delete Hankaku Space between Hiragana, Katakana, and Kanji, and Alphabet
{"アルゴリズム Go", "アルゴリズムGo"},
{"Algorithm Go", "Algorithm Go"},
// general test
{"公立 はこだて 未来 大学 Future University Hakodate",
"公立はこだて未来大学Future University Hakodate"},
{"公立 はこだて 未来 大学- Future* University+ Hakodate",
"公立はこだて未来大学-Future*University+Hakodate"},
}
for index, testcase := range testcases {
if s := preNormalizer(testcase.input); s != testcase.expect {
t.Errorf("failed: %d expects\"%s\" but output was \"%s\"", index, testcase.expect, s)
}
}
}