Class: Basset::Document
- Inherits:
-
Object
- Object
- Basset::Document
- Defined in:
- lib/basset/document.rb
Overview
A class for representing a document as a vector of features. It takes the text of the document and the classification. The vector of features representation is just a basic bag of words approach.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#classification ⇒ Object
readonly
Returns the value of attribute classification.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text, classification = nil) ⇒ Document
constructor
A new instance of Document.
- #vector_of_features ⇒ Object
Constructor Details
#initialize(text, classification = nil) ⇒ Document
Returns a new instance of Document.
9 10 11 12 |
# File 'lib/basset/document.rb', line 9 def initialize(text, classification = nil) @text = text @classification = classification end |
Instance Attribute Details
#classification ⇒ Object (readonly)
Returns the value of attribute classification.
7 8 9 |
# File 'lib/basset/document.rb', line 7 def classification @classification end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
7 8 9 |
# File 'lib/basset/document.rb', line 7 def text @text end |
Instance Method Details
#vector_of_features ⇒ Object
14 15 16 |
# File 'lib/basset/document.rb', line 14 def vector_of_features @feature_vector ||= vector_of_features_from_terms_hash( terms_hash_from_words_array( stemmed_words ) ) end |