Class: RecommEngine::Matcher
- Inherits:
-
Object
- Object
- RecommEngine::Matcher
- Defined in:
- lib/recommengine/matcher.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#num ⇒ Object
readonly
Returns the value of attribute num.
-
#similarity ⇒ Object
readonly
Returns the value of attribute similarity.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #bottom_matches ⇒ Object
-
#initialize(data:, subject:, similarity: RecommEngine::DEFAULT_ALGORITHM, num: RecommEngine::DEFAULT_MATCHES_NUMBER) ⇒ Matcher
constructor
A new instance of Matcher.
- #top_matches ⇒ Object
Constructor Details
#initialize(data:, subject:, similarity: RecommEngine::DEFAULT_ALGORITHM, num: RecommEngine::DEFAULT_MATCHES_NUMBER) ⇒ Matcher
Returns a new instance of Matcher.
5 6 7 8 9 10 |
# File 'lib/recommengine/matcher.rb', line 5 def initialize(data:, subject:, similarity: RecommEngine::DEFAULT_ALGORITHM, num: RecommEngine::DEFAULT_MATCHES_NUMBER) @data = data @subject = subject @similarity = similarity @num = num end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/recommengine/matcher.rb', line 3 def data @data end |
#num ⇒ Object (readonly)
Returns the value of attribute num.
3 4 5 |
# File 'lib/recommengine/matcher.rb', line 3 def num @num end |
#similarity ⇒ Object (readonly)
Returns the value of attribute similarity.
3 4 5 |
# File 'lib/recommengine/matcher.rb', line 3 def similarity @similarity end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
3 4 5 |
# File 'lib/recommengine/matcher.rb', line 3 def subject @subject end |
Instance Method Details
#bottom_matches ⇒ Object
16 17 18 |
# File 'lib/recommengine/matcher.rb', line 16 def bottom_matches all_matches[0..upper_limit] end |
#top_matches ⇒ Object
12 13 14 |
# File 'lib/recommengine/matcher.rb', line 12 def top_matches all_matches.reverse[0..upper_limit] end |