1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-07-02 01:50:29 +08:00

code refactor for RegexpSplit function, moved it to util.go, add return chan string

This commit is contained in:
Wang Bin
2015-03-24 14:40:06 +08:00
parent 323b6714fa
commit 0027927b6d
5 changed files with 178 additions and 55 deletions

View File

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