From 8cc5ed2d63fe1de830009586b0102fc02f07ebfb Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 28 Jun 2010 23:40:28 +0200 Subject: [PATCH] markov: strip lines before learning them This prevents a dead loop when learning lines starting with whitespace, which could otherwise happen e.g. when learning from a file. --- data/rbot/plugins/markov.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index 8ccb0caf..0475ab4d 100755 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -637,7 +637,7 @@ class MarkovPlugin < Plugin def learn_line(message) # debug "learning #{message.inspect}" - wordlist = message.split(/\s+/).reject do |w| + wordlist = message.strip.split(/\s+/).reject do |w| @bot.config['markov.ignore_patterns'].map do |pat| w =~ Regexp.new(pat.to_s) end.select{|v| v}.size != 0 -- 2.39.5