From 8730fade6a8285a747367deef652b20370dfe83b Mon Sep 17 00:00:00 2001 From: Voker57 Date: Sat, 19 Dec 2009 18:44:41 +0300 Subject: markov: Intern only when it makes sense --- data/rbot/plugins/markov.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'data') diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index a2b938a1..c574fd4b 100755 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -153,7 +153,7 @@ class MarkovPlugin < Plugin next else # intern after clearing leftover end-of-actions if present - sym = w.chomp("\001").intern + sym = w.chomp("\001") end end hash[sym] += 1 @@ -542,7 +542,7 @@ class MarkovPlugin < Plugin else pairs = seq_pairs(words).sort_by { rand } pairs.each do |word1, word2| - line = generate_string(word1.intern, word2.intern) + line = generate_string(word1, word2) if line and message.index(line) != 0 reply_delay m, line return @@ -640,12 +640,12 @@ class MarkovPlugin < Plugin @bot.config['markov.ignore_patterns'].map do |pat| w =~ Regexp.new(pat.to_s) end.select{|v| v}.size != 0 - end.map { |w| w.intern } + end return unless wordlist.length >= 2 word1, word2 = MARKER, MARKER wordlist << MARKER wordlist.each do |word3| - learn_triplet(word1, word2, word3) + learn_triplet(word1, word2, word3.to_sym) word1, word2 = word2, word3 end end -- cgit v1.2.3