🐛 兼容linux和windows文件换行不同 (#199)

This commit is contained in:
himawari 2022-04-19 23:00:01 +08:00 committed by GitHub
parent ccb58e0a6c
commit 3553683bb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ func init() {
ctx.SendChain(message.Text("ERROR:", err)) ctx.SendChain(message.Text("ERROR:", err))
return false return false
} }
stopwords = strings.Split(binary.BytesToString(data), "\r\n") stopwords = strings.Split(strings.ReplaceAll(binary.BytesToString(data), "\r", ""), "\n")
sort.Strings(stopwords) sort.Strings(stopwords)
logrus.Infoln("[wordcount]加载", len(stopwords), "条停用词") logrus.Infoln("[wordcount]加载", len(stopwords), "条停用词")
return true return true