Class: Foundries::Recording::Aggregator
- Inherits:
-
Object
- Object
- Foundries::Recording::Aggregator
- Defined in:
- lib/foundries/recording/aggregator.rb
Instance Method Summary collapse
- #candidates ⇒ Object
-
#initialize(results) ⇒ Aggregator
constructor
A new instance of Aggregator.
Constructor Details
#initialize(results) ⇒ Aggregator
Returns a new instance of Aggregator.
8 9 10 |
# File 'lib/foundries/recording/aggregator.rb', line 8 def initialize(results) @results = results end |
Instance Method Details
#candidates ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/foundries/recording/aggregator.rb', line 12 def candidates return [] if @results.empty? normalized = normalize_results full_tree_candidates = group_by_full_tree(normalized) subtree_candidates = find_common_subtrees(normalized) merged = merge_candidates(full_tree_candidates, subtree_candidates) filtered = merged.reject { |c| c[:tree_size] <= 1 } filtered.sort_by { |c| -c[:score] } end |