diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-06-28 23:40:28 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-06-28 23:40:28 +0200 |
commit | 8cc5ed2d63fe1de830009586b0102fc02f07ebfb (patch) | |
tree | 6b0a174a5b0feee3d6e2fb25dff06e41c290e7c4 /data/rbot/plugins/markov.rb | |
parent | 13f34a595e3dca7171dc466cc6afece0ce2adcc5 (diff) |
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.
Diffstat (limited to 'data/rbot/plugins/markov.rb')
-rwxr-xr-x | data/rbot/plugins/markov.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |