Class: Company::Mapping::TermFrequency

Inherits:
Object
  • Object
show all
Defined in:
lib/company/mapping/tfidf/tf/term_frequency.rb

Overview

Raw term frequency (number of times a token appears in a given string - document)

Direct Known Subclasses

NormalizedTermFrequency

Instance Method Summary collapse

Constructor Details

#initialize(tokenizer) ⇒ TermFrequency



6
7
8
# File 'lib/company/mapping/tfidf/tf/term_frequency.rb', line 6

def initialize(tokenizer)
  @tokenizer = tokenizer
end

Instance Method Details

#calculate(text) ⇒ Object

Calculates the raw term frequency given the contents of the document.



11
12
13
# File 'lib/company/mapping/tfidf/tf/term_frequency.rb', line 11

def calculate(text)
  rawFrequency(text)
end