golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
import (
"regexp"
"strings"
+ "unicode"
+
+ "golang.org/x/text/runes"
+ "golang.org/x/text/transform"
+ "golang.org/x/text/unicode/norm"
+ "golang.org/x/text/width"
)
// Replace all strings in a string array with a new string
}
return "???"
}
+
+func normaliceString(s string) string {
+
+ t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC, runes.If(runes.In(unicode.Latin), width.Fold, nil))
+ result, _, _ := transform.String(t, s)
+
+ return result
+}
+
+// Remove exclamation marks, question marks, apostrophes, and punctuation from a string
+func removePunctuation(s string) string {
+ // Define the punctuation characters to remove
+ punctuation := []string{"¡", "!", "¿", "?", "'", ".", ",", ";", ":", "-", "_", "\"", "\n"}
+
+ // Replace each punctuation character with an empty string
+ for _, p := range punctuation {
+ s = strings.ReplaceAll(s, p, "")
+ }
+
+ return s
+}
+
+// Replace multiple spaces with a single space in a string
+func trimMultipleSpaces(s string) string {
+ re := regexp.MustCompile(`\s+`)
+ return re.ReplaceAllString(s, " ")
+}
+
+// Replace multiple spaces with a single space in a string
+func removeCommand(s string) string {
+ re := regexp.MustCompile(`^/[^/\s]+`)
+ commandMatch := re.FindString(s)
+ if commandMatch != "" {
+ s = strings.TrimPrefix(s, commandMatch)
+ s = strings.TrimSpace(s)
+ }
+ return s
+}
+
+// get only command from a string (starting /word)
+func getCommand(s string) string {
+ re := regexp.MustCompile(`^/[^/\s]+`)
+ commandMatch := re.FindString(s)
+ if commandMatch != "" {
+ return commandMatch
+ }
+ return ""
+}