I have a string that I want to compare against an array of strings, and return the array element that most closely matches.
I can write a sliding correlator that counts the number of matching characters at each step and returns the max correlation. But is there a better way?
For example:
control_string = drv_probability_1_max
List:
burst_period_min/max
duty_cycle_min/max
probablility_0_min/max
probablility_1_min/max
Where ideally it returns "probablility_1_min/max"
You might be looking for the String::Similarity
module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With