Class: StringUtilityBelt::MatchRank::MATCHRANK

Inherits:
Object
  • Object
show all
Defined in:
lib/string_utility_belt/match_rank.rb

Constant Summary

TOTAL_TEMPLATE =
{:exact => 0, :matched => 0}
SCORE_TEMPLATE =
TOTAL_TEMPLATE.merge({:precision => 0})

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ MATCHRANK

Returns a new instance of MATCHRANK



9
10
11
# File 'lib/string_utility_belt/match_rank.rb', line 9

def initialize(string)
  @text = string
end

Instance Method Details

#frequency(options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/string_utility_belt/match_rank.rb', line 13

def frequency(options)
  @options = options
  @result  = result_template

  for @search_word in search_words
    for @text_word in @text.words
      count_exact_matches
      count_fragmet_matches
    end
  end

  calculate_the_precision if @options[:template] == :precision

  return @result
end