Class: Dictionary
- Inherits:
-
Object
- Object
- Dictionary
- Defined in:
- lib/rbbt/bow/dictionary.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#terms ⇒ Object
readonly
Returns the value of attribute terms.
Instance Method Summary collapse
- #add(terms, &block) ⇒ Object
-
#initialize ⇒ Dictionary
constructor
A new instance of Dictionary.
Constructor Details
#initialize ⇒ Dictionary
Returns a new instance of Dictionary.
3 4 5 |
# File 'lib/rbbt/bow/dictionary.rb', line 3 def initialize @terms = Hash.new(0) end |
Instance Attribute Details
#terms ⇒ Object (readonly)
Returns the value of attribute terms.
2 3 4 |
# File 'lib/rbbt/bow/dictionary.rb', line 2 def terms @terms end |
Instance Method Details
#add(terms, &block) ⇒ Object
7 8 9 10 11 |
# File 'lib/rbbt/bow/dictionary.rb', line 7 def add(terms, &block) terms.each{|term, count| @terms[term] += count } end |