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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user