3v324v23's picture
Зафиксирована рабочая версия TEN-Agent для HuggingFace Space
87337b1
raw
history blame contribute delete
525 Bytes
package extension
func isPunctuation(r rune) bool {
if r == ',' || r == ',' ||
r == '.' || r == '。' ||
r == '?' || r == '?' ||
r == '!' || r == '!' {
return true
}
return false
}
func parseSentence(sentence, content string) (string, string, bool) {
var remain string
var foundPunc bool
for _, r := range content {
if !foundPunc {
sentence += string(r)
} else {
remain += string(r)
}
if !foundPunc && isPunctuation(r) {
foundPunc = true
}
}
return sentence, remain, foundPunc
}