1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-09 19:20:26 +08:00

added util module

This commit is contained in:
Wang Bin
2015-04-30 15:26:34 +08:00
parent 732196127b
commit d9f77563bf
4 changed files with 74 additions and 65 deletions

24
util/util_test.go Normal file
View File

@@ -0,0 +1,24 @@
package util
import (
"regexp"
"testing"
)
func TestRegexpSplit(t *testing.T) {
result := RegexpSplit(regexp.MustCompile(`\p{Han}+`),
"BP神经网络如何训练才能在分类时增加区分度", -1)
if len(result) != 2 {
t.Fatal(result)
}
result = RegexpSplit(regexp.MustCompile(`(\p{Han})+`),
"BP神经网络如何训练才能在分类时增加区分度", -1)
if len(result) != 3 {
t.Fatal(result)
}
result = RegexpSplit(regexp.MustCompile(`([\p{Han}#]+)`),
",BP神经网络如何训练才能在分类时#增加区分度?", -1)
if len(result) != 3 {
t.Fatal(result)
}
}