Reputation: 1737
How can i calculate how much a text has changed?
For example the following text:
1. this is a test
Compared to
2. this is a testx
The change here is very small (addition of x at the end)
The following change is big:
1. this is a test
2. this is a test with more text
(here i added 'with more text')
I thought of measuring string length and use that to calculate a change percentage. But this approach goes bad in the following case:
1. this is a test
2. and i rewrite
(almost the same length, but totally different text)
I suspect many people bumped into this problem. But i can't seem to find much on google, likely caused by not knowing what the technology is named that can measure a change in text.
Upvotes: 0
Views: 715
Reputation: 190
Depends on the language, but java and python both have pretty good string comparative functions so you would just need to write up a specific algorithm and use some looping to create a degree of error, or change.
Upvotes: 0
Reputation: 52185
You could use the Levenshtein Distance Metric to see how much the strings differ from each other, the higher the value, the more different the strings are.
There are other string comparison metrics you can take a look at as well.
Upvotes: 1