lib/asker/ai/ai_calculate.rb in asker-tool-2.6.0 vs lib/asker/ai/ai_calculate.rb in asker-tool-2.7.0

- old
+ new

@@ -10,32 +10,32 @@ def get_list1_and_list2_from(p_table) # create <list1> with all the rows from the table list1 = [] count = 1 p_table.rows.each do |i| - list1 << { id: count, weight: 0, data: i } + list1 << {id: count, weight: 0, data: i} count += 1 end # create a <list2> with similar rows (same table name) from the neighbours tables list2 = [] concept.neighbors.each do |n| n[:concept].tables.each do |t2| next if t2.name != p_table.name t2.rows.each do |i| - list2 << { id: count, weight: 0, data: i } + list2 << {id: count, weight: 0, data: i} count += 1 end end end [list1, list2] end def calculate_nearness_between_texts(text1, text2) return 0.0 if text2.nil? || text2.empty? - words = text1.split(' ') + words = text1.split(" ") count = 0 words.each { |w| count += 1 if text2.include?(w) } (count * 100 / words.count) end