Class: JohnDoe::ChatBot

Inherits:
Object
  • Object
show all
Defined in:
lib/john-doe.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename = File.dirname(__FILE__) + "/../default.yml", quotes_filename = "quotes") ⇒ ChatBot

Returns a new instance of ChatBot.



8
9
10
11
12
13
14
15
16
# File 'lib/john-doe.rb', line 8

def initialize(filename = File.dirname(__FILE__) + "/../default.yml" , quotes_filename = "quotes")
  unless File.exists? quotes_filename
    f = File.new(quotes_filename,"w")
    f.close
  end
  @loader = JohnDoe::Aiml.new
  @loader.load(filename)
  @responser = JohnDoe::Responser.new(@loader,quotes_filename)
end

Instance Method Details

#get_response(s) ⇒ Object



17
18
19
# File 'lib/john-doe.rb', line 17

def get_response(s)
  @responser.response s
end