Algorithm / Library for measuring the degree of equality of strings

Is there an algorithm that gives two lines, gives a degree of equality between them, using metrics that can be provided externally? For example, the two lines "Plant code" and "PlantCode" can be equal to 0.8, "Plant code" and "Plant" can be equal to 0.6, "Truck no" and "shipment details" can be equal to 0.6 ( using dictionaries with syntax provided at least). The numbers are compiled, but I hope they all understand. Is there such an algorithm? I would prefer it to be like a library, instead of implementing it yourself. Any help would be greatly appreciated. Thanks.

+4
source share
3 answers

Try the Simmetrics library. It provides a range of symmetry indicators.

+4
source

Perhaps the google-diff-match-patch library may help: this library implements the Myer diff algorithm, which is usually considered the best universal different.

+3
source

There is also a Levenshtein distance algorithm and its example java implementation . However, it does not allow the provision of external metrics.

+3
source

All Articles