sergi / go-diff

Diff, match and patch text in Go
MIT License
1.81k stars 207 forks source link

How to tell percent different #109

Closed vbisbest closed 3 years ago

vbisbest commented 4 years ago

Thoughts on determining how different two files are? Say we compare file1.txt to file2.txt and I would like to see that they are 90% similar. Is that something I can determine with this current library or something that would need to be added? Thanks!

habdank commented 3 years ago

IMHO this is not precisely defined requirement. What means files have 0%, 50% or 90% similarity? Generally the library provides you very good metric, which is Levenstein distance. With this one you can measure how documents differs.

sergi commented 3 years ago

I agree with @habdank. Providing the percentage of difference is beyond the scope of this library.