Class: JohnDoe::Aiml

Inherits:
Object
  • Object
show all
Defined in:
lib/johndoe/aiml.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAiml

Returns a new instance of Aiml.



6
7
8
9
10
11
12
13
# File 'lib/johndoe/aiml.rb', line 6

def initialize
  @rules = []
  @patterns = {}
  @responses = []
  @default = []
  @knowledge = []
  @emotions = {}
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



5
6
7
# File 'lib/johndoe/aiml.rb', line 5

def default
  @default
end

#emotionsObject

Returns the value of attribute emotions.



5
6
7
# File 'lib/johndoe/aiml.rb', line 5

def emotions
  @emotions
end

#knowledgeObject

Returns the value of attribute knowledge.



5
6
7
# File 'lib/johndoe/aiml.rb', line 5

def knowledge
  @knowledge
end

#patternsObject

Returns the value of attribute patterns.



5
6
7
# File 'lib/johndoe/aiml.rb', line 5

def patterns
  @patterns
end

#responsesObject

Returns the value of attribute responses.



5
6
7
# File 'lib/johndoe/aiml.rb', line 5

def responses
  @responses
end

#rulesObject

Returns the value of attribute rules.



5
6
7
# File 'lib/johndoe/aiml.rb', line 5

def rules
  @rules
end

Instance Method Details

#load(filename) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/johndoe/aiml.rb', line 15

def load(filename)
  data= YAML::load_file(filename)
  collect_data data
  @default = data['default']
  @knowledge = data['knowledge']
  normalise_default
end