Class: Clusterer::TermsCount

Inherits:
Hash
  • Object
show all
Defined in:
lib/clusterer/inverse_document_frequency.rb

Overview

TermsCount is used to store the count of number of documents in which the term has been seen. This class could have been just replaced by a simple hash object, in InverseDocumentFrequency class but to make the InverseDocumentFrequency class more flexible and be able to store the term count in DB/File store this class is provided.

Instance Method Summary collapse

Instance Method Details

#increment_count(term) ⇒ Object



46
47
48
# File 'lib/clusterer/inverse_document_frequency.rb', line 46

def increment_count(term)
  self[term] = (self[term] || 0) + 1
end