Class: Fuzzy::Scorer::TermSet
- Inherits:
-
Struct
- Object
- Struct
- Fuzzy::Scorer::TermSet
- Defined in:
- lib/fuzzy.rb
Instance Attribute Summary collapse
-
#terms ⇒ Object
Returns the value of attribute terms.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
Instance Attribute Details
#terms ⇒ Object
Returns the value of attribute terms
7 8 9 |
# File 'lib/fuzzy.rb', line 7 def terms @terms end |
#weight ⇒ Object
Returns the value of attribute weight
7 8 9 |
# File 'lib/fuzzy.rb', line 7 def weight @weight end |
Instance Method Details
#cleaned_terms ⇒ Object
8 9 10 |
# File 'lib/fuzzy.rb', line 8 def cleaned_terms terms.flat_map{|t| t.parameterize.split('-')}.to_set end |
#token_weight(total_weight) ⇒ Object
12 13 14 |
# File 'lib/fuzzy.rb', line 12 def token_weight total_weight weight.fdiv(total_weight * terms.size) end |