我如何匹配句子中的所有单词?
词:[“测试”,“测试通知”,“结果警报”,“警报测试”]
句子:“报警结果测试”
我期待这样的事情
[o] test
[x] test noti
[o] result alarm
[o] alarm test
我试着用文字分开,
var words []string
words = append(words, "test", "test noti", "result alarm", "alarm test")
sentence := "alarm result test"
for i := 0; i < len(words); i++ {
log.Info(strings.Split(words[i], " "))
}
茅侃侃
相关分类