ahocorasick icon indicating copy to clipboard operation
ahocorasick copied to clipboard

exception case

Open zj611 opened this issue 1 year ago • 0 comments

异常case不能通过测试,无法命中“国人”这个词

func Test2(t *testing.T) {
	ac := NewMatcher()

	dictionary := []string{"中国人民", "国人", "hello世界", "hello"}
	ac.Build(dictionary)

	ret := ac.Match("中国人")
	for _, v := range ret {
		fmt.Println(v.Index, v.EndPosition)
	}
	//if len(ret) != 4 {
	//	t.Fatal()
	//}
	//
	//ret = ac.Match("世界")
	//if len(ret) != 1 {
	//	t.Fatal()
	//}
	//
	//ret = ac.Match("hello")
	//if len(ret) != 2 {
	//	t.Fatal()
	//}
}

zj611 avatar Jul 28 '23 08:07 zj611