Pair2 v0.1.1 Pair2.Comparer View Source
Core functions for comparing two values or maps and returning a similarity value between 0.0 and 1.0.
Link to this section Summary
Functions
Based on argument types and values, selects one of the compare_* methods to use for comparing x and y
Compares the absolute difference between dates x and y and returns the similarity expressed as the difference in days divided by the max_days argument. Return value is between 0.0 and 1.0
Scores the similarity of two maps based on a list of rules. Returns score that is >= 0.0
Compares the absolute difference between numbers x and y and returns the similarity expressed as the difference divided by the larger of x or y. Return value is between 0.0 and 1.0
Compares x and y using the match criteria defined in the fun argument. Function should return value between 0.0 and 1.0
Link to this section Functions
Based on argument types and values, selects one of the compare_* methods to use for comparing x and y.
Compares the absolute difference between dates x and y and returns the similarity expressed as the difference in days divided by the max_days argument. Return value is between 0.0 and 1.0.
Scores the similarity of two maps based on a list of rules. Returns score that is >= 0.0.
Compares the absolute difference between numbers x and y and returns the similarity expressed as the difference divided by the larger of x or y. Return value is between 0.0 and 1.0.
Examples
iex> Compare.compare_nums(5, 10) 0.5
Compares x and y using the match criteria defined in the fun argument. Function should return value between 0.0 and 1.0