I have implemented a custom ruby method which groups similar text using loops,
array = ["South East Queensland", "Wide Bay Burnett", "Margaret River", "Port Pirie", "Gippsland", "Elizabeth", "Barossa"]
similarity_group = []
similarity_percentage = 60.0
array.each do |first_text|
results.each do |second_text|
result = first_text.upcase.similar(second_text.upcase)
if result >= similarity_percentage
...
...
...
end
end
end
consider the above implementation for 2000 element,then to group them it will cost 4000000 iteration because, each element will check with each other.
is there any performant solution or gems or library like grouping a bulk array based on their similarity.
(I need to use the same array element for similarity check)
sample expectation : [array1].similarity([array1])