markov: undo string cleanup changes
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		
							parent
							
								
									fac04ea3dc
								
							
						
					
					
						commit
						84e0f661c8
					
				
					 1 changed files with 5 additions and 8 deletions
				
			
		| 
						 | 
					@ -115,9 +115,9 @@ func markovParseText(text string) string {
 | 
				
			||||||
	text = strings.Replace(text, ">", ">", -1)
 | 
						text = strings.Replace(text, ">", ">", -1)
 | 
				
			||||||
	text = strings.Replace(text, "&", "&", -1)
 | 
						text = strings.Replace(text, "&", "&", -1)
 | 
				
			||||||
	text = strings.Replace(text, ",", " ", -1)
 | 
						text = strings.Replace(text, ",", " ", -1)
 | 
				
			||||||
	reg := regexp.MustCompile("[^a-zA-Z0-9 ]+")
 | 
						//reg := regexp.MustCompile("[^a-zA-Z0-9 ]+")
 | 
				
			||||||
	delText := reg.ReplaceAllString(text, "")
 | 
						//delText := reg.ReplaceAllString(text, "")
 | 
				
			||||||
	return strings.ToLower(delText)
 | 
						return strings.ToLower(text)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Prefix is a Markov chain prefix of one or more words.
 | 
					// Prefix is a Markov chain prefix of one or more words.
 | 
				
			||||||
| 
						 | 
					@ -213,13 +213,10 @@ func (c *MarkovChain) Generate(n int, in string) string {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			next := choices[rand.Intn(len(choices))]
 | 
								next := choices[rand.Intn(len(choices))]
 | 
				
			||||||
			words = append(words, next)
 | 
								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 rand.Intn(100) < n {
 | 
					 | 
				
			||||||
				break
 | 
									break
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								p.Shift(next)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if len(words) > 0 {
 | 
							if len(words) > 0 {
 | 
				
			||||||
			break
 | 
								break
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue