ds2api / internal /textclean /reference_markers.go
204848
Initial commit: ds2api with HF Spaces support
feccc69
Raw
History Blame Contribute Delete
521 Bytes
package textclean
import "regexp"
var citationReferenceMarkerPattern = regexp.MustCompile(`(?i)\[(citation|reference):\s*\d+\]`)
func StripReferenceMarkers(text string) string {
if text == "" {
return text
}
return citationReferenceMarkerPattern.ReplaceAllString(text, "")
}
// StripReferenceMarkersEnabled returns the default for streaming surfaces,
// where partial citation/reference markers are hidden before the final
// link metadata is available.
func StripReferenceMarkersEnabled() bool {
return true
}