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:
24
util/util_test.go
Normal file
24
util/util_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user