diff options
author | Voker57 <voker57@gmail.com> | 2009-12-19 18:44:41 +0300 |
---|---|---|
committer | Voker57 <voker57@gmail.com> | 2010-01-26 00:41:08 +0300 |
commit | 8730fade6a8285a747367deef652b20370dfe83b (patch) | |
tree | 8870a9eabd57ebb58d3cbd5f89ef83192bc00245 /data | |
parent | f85f0ce48ebe8cc46b2d2ee0eb6dad20abda9610 (diff) |
markov: Intern only when it makes sense
Diffstat (limited to 'data')
-rwxr-xr-x | data/rbot/plugins/markov.rb | 8 |
1 files changed, 4 insertions, 4 deletions
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 |