Class: ProgramR::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/programr/aiml_elements.rb

Constant Summary collapse

@@cardinality =
0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCategory

Returns a new instance of Category.



9
10
11
12
13
# File 'lib/programr/aiml_elements.rb', line 9

def initialize 
  @@cardinality += 1 
  @pattern = []
  @that    = []
end

Instance Attribute Details

#templateObject

Returns the value of attribute template.



6
7
8
# File 'lib/programr/aiml_elements.rb', line 6

def template
  @template
end

#thatObject

Returns the value of attribute that.



6
7
8
# File 'lib/programr/aiml_elements.rb', line 6

def that
  @that
end

#topicObject

Returns the value of attribute topic.



6
7
8
# File 'lib/programr/aiml_elements.rb', line 6

def topic
  @topic
end

Class Method Details

.cardinalityObject



15
# File 'lib/programr/aiml_elements.rb', line 15

def Category.cardinality; @@cardinality end

Instance Method Details

#add_pattern(anObj) ⇒ Object



17
18
19
# File 'lib/programr/aiml_elements.rb', line 17

def add_pattern(anObj)
  @pattern.push(anObj)
end

#add_that(anObj) ⇒ Object



21
22
23
# File 'lib/programr/aiml_elements.rb', line 21

def add_that(anObj)
  @that.push(anObj)
end

#get_patternObject



25
26
27
28
29
30
31
# File 'lib/programr/aiml_elements.rb', line 25

def get_pattern
  res = ''
  @pattern.each{|tocken|
    res += tocken.to_s
  }
  return res.split(/\s+/)
end

#get_thatObject



33
34
35
36
37
38
39
# File 'lib/programr/aiml_elements.rb', line 33

def get_that
  res = ''
  @that.each{|tocken|
    res += tocken.to_s
  }
  return res.split(/\s+/)
end