summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rwxr-xr-xdata/rbot/plugins/markov.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb
index deeb9cae..4fffe564 100755
--- a/data/rbot/plugins/markov.rb
+++ b/data/rbot/plugins/markov.rb
@@ -24,6 +24,10 @@ class MarkovPlugin < Plugin
:default => 50,
:validate => Proc.new { |v| (0..100).include? v },
:desc => "Maximum number of words the bot should put in a sentence")
+ Config.register Config::IntegerValue.new('markov.learn_delay',
+ :default => 0.5,
+ :validate => Proc.new { |v| v >= 0 },
+ :desc => "Time the learning thread spends sleeping after learning a line. If set to zero, learning from files can be very CPU intensive, but also faster.")
def initialize
super
@@ -45,7 +49,7 @@ class MarkovPlugin < Plugin
@learning_thread = Thread.new do
while s = @learning_queue.pop
learn_line s
- sleep 0.5
+ sleep @bot.config['markov.learn_delay'] unless @bot.config['markov.learn_delay'].zero?
end
end
@learning_thread.priority = -1