Method: Coopy::IndexPair#index_tables

Defined in:
lib/coopy/index_pair.rb

#index_tables(a, b) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/coopy/index_pair.rb', line 20

def index_tables(a, b)
  @ia.index_table a
  @ib.index_table b
  # calculate
  #   P(present and unique within a AND present and unique with b)
  #     for rows in a
  good = 0
  @ia.items.keys.each do |key|
    item_a = @ia.items[key]
    spot_a = item_a.lst.length
    item_b = @ib.items[key]
    spot_b = 0;
    spot_b = item_b.lst.length if item_b
    if spot_a == 1 && spot_b == 1
      good += 1
    end
  end
  @quality = good / [1.0,a.height].max
end