Class: OmniCat::Classifiers::BayesInternals::Category
- Defined in:
- lib/omnicat/classifiers/bayes_internals/category.rb
Instance Attribute Summary collapse
-
#doc_count ⇒ Object
Returns the value of attribute doc_count.
-
#prior ⇒ Object
Returns the value of attribute prior.
-
#token_count ⇒ Object
Returns the value of attribute token_count.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(category_hash = {}) ⇒ Category
constructor
A new instance of Category.
Methods inherited from Base
Constructor Details
#initialize(category_hash = {}) ⇒ Category
Returns a new instance of Category.
7 8 9 10 11 12 |
# File 'lib/omnicat/classifiers/bayes_internals/category.rb', line 7 def initialize(category_hash = {}) self.doc_count = category_hash[:doc_count].to_i self.prior = category_hash[:prior].to_f self.tokens = category_hash[:tokens] || {} self.token_count = category_hash[:token_count].to_i end |
Instance Attribute Details
#doc_count ⇒ Object
Returns the value of attribute doc_count.
5 6 7 |
# File 'lib/omnicat/classifiers/bayes_internals/category.rb', line 5 def doc_count @doc_count end |
#prior ⇒ Object
Returns the value of attribute prior.
5 6 7 |
# File 'lib/omnicat/classifiers/bayes_internals/category.rb', line 5 def prior @prior end |
#token_count ⇒ Object
Returns the value of attribute token_count.
5 6 7 |
# File 'lib/omnicat/classifiers/bayes_internals/category.rb', line 5 def token_count @token_count end |
#tokens ⇒ Object
Returns the value of attribute tokens.
5 6 7 |
# File 'lib/omnicat/classifiers/bayes_internals/category.rb', line 5 def tokens @tokens end |