Class: BowTfidf::Computation

Inherits:
Object
  • Object
show all
Defined in:
lib/bow_tfidf/computation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bow) ⇒ Computation

Returns a new instance of Computation.

Raises:

  • (ArgumentError)


5
6
7
8
9
# File 'lib/bow_tfidf/computation.rb', line 5

def initialize(bow)
  raise(ArgumentError, 'BowTfidf::BagOfWords instance expected') unless bow.is_a?(BowTfidf::BagOfWords)

  @bow = bow
end

Instance Attribute Details

#bowObject (readonly)

Returns the value of attribute bow.



3
4
5
# File 'lib/bow_tfidf/computation.rb', line 3

def bow
  @bow
end

Instance Method Details

#callObject



11
12
13
14
15
# File 'lib/bow_tfidf/computation.rb', line 11

def call
  compute_idf
  compute_tfidf
  bow
end