markov.go: Convert text input to lowercase before parsing
This commit is contained in:
		
							parent
							
								
									450abd2ced
								
							
						
					
					
						commit
						0f080a2946
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -44,7 +44,7 @@ func markovHandleMessage(m *irc.Message) {
 | 
			
		|||
 | 
			
		||||
	answerLen, _ := strconv.Atoi(ModParams["markov-answer-len"])
 | 
			
		||||
	respChance, _ := strconv.Atoi(ModParams["markov-response-chance"])
 | 
			
		||||
	if rand.Intn(100) <= respChance || strings.Index(text, ModParams["_nick"]) != -1 {
 | 
			
		||||
	if rand.Intn(100) <= respChance || strings.Index(text, strings.ToLower(ModParams["_nick"])) != -1 {
 | 
			
		||||
		responseText := markovChain.Generate(answerLen, text)
 | 
			
		||||
		if responseText != "" {
 | 
			
		||||
			go func() {
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ func markovParseText(text string) string {
 | 
			
		|||
	text = strings.Replace(text, ">", ">", -1)
 | 
			
		||||
	text = strings.Replace(text, "&", "&", -1)
 | 
			
		||||
 | 
			
		||||
	return text
 | 
			
		||||
	return strings.ToLower(text)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Prefix is a Markov chain prefix of one or more words.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue