Class: ProgramR::Category
- Inherits:
-
Object
- Object
- ProgramR::Category
- Defined in:
- lib/programr/aiml_elements.rb
Constant Summary collapse
- @@cardinality =
0
Instance Attribute Summary collapse
-
#template ⇒ Object
Returns the value of attribute template.
-
#that ⇒ Object
Returns the value of attribute that.
-
#topic ⇒ Object
Returns the value of attribute topic.
Class Method Summary collapse
Instance Method Summary collapse
- #add_pattern(anObj) ⇒ Object
- #add_that(anObj) ⇒ Object
- #get_pattern ⇒ Object
- #get_that ⇒ Object
-
#initialize ⇒ Category
constructor
A new instance of Category.
Constructor Details
#initialize ⇒ Category
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
#template ⇒ Object
Returns the value of attribute template.
6 7 8 |
# File 'lib/programr/aiml_elements.rb', line 6 def template @template end |
#that ⇒ Object
Returns the value of attribute that.
6 7 8 |
# File 'lib/programr/aiml_elements.rb', line 6 def that @that end |
#topic ⇒ Object
Returns the value of attribute topic.
6 7 8 |
# File 'lib/programr/aiml_elements.rb', line 6 def topic @topic end |
Class Method Details
.cardinality ⇒ Object
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_pattern ⇒ Object
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_that ⇒ Object
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 |