Class: StringUtilityBelt::MatchRank::MATCHRANK
- Inherits:
-
Object
- Object
- StringUtilityBelt::MatchRank::MATCHRANK
- Defined in:
- lib/string_utility_belt/match_rank.rb
Constant Summary collapse
- TOTAL_TEMPLATE =
{:exact => 0, :matched => 0}
- SCORE_TEMPLATE =
TOTAL_TEMPLATE.merge({:precision => 0})
Instance Method Summary collapse
- #frequency(options) ⇒ Object
-
#initialize(string) ⇒ MATCHRANK
constructor
A new instance of MATCHRANK.
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 = @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 |