diff --git a/modules/markov.go b/modules/markov.go index 876dbf3..06b169c 100644 --- a/modules/markov.go +++ b/modules/markov.go @@ -115,8 +115,9 @@ func markovParseText(text string) string { text = strings.Replace(text, ">", ">", -1) text = strings.Replace(text, "&", "&", -1) text = strings.Replace(text, ",", " ", -1) - - return strings.ToLower(text) + reg := regexp.MustCompile("[^a-zA-Z0-9 ]+") + delText := reg.ReplaceAllString(text, "") + return strings.ToLower(delText) } // Prefix is a Markov chain prefix of one or more words. @@ -212,9 +213,9 @@ func (c *MarkovChain) Generate(n int, in string) string { } next := choices[rand.Intn(len(choices))] words = append(words, next) - if strings.HasSuffix(next, ".") || strings.HasSuffix(next, "!") || strings.HasSuffix(next, "?") { + /*if strings.HasSuffix(next, ".") || strings.HasSuffix(next, "!") || strings.HasSuffix(next, "?") { break - } + }*/ p.Shift(next) } if len(words) > 0 {