Rosetta Code:Village Pump/LevenshteinDistance

From Rosetta Code
LevenshteinDistance
This is a particular discussion thread among many which consider Rosetta Code.

Summary

How to contribute and fix errors

Discussion

So, been using RC for a while, but recently trying to find my around here in order to help contribute. However, I am unsure regarding a few ways-of-working.

On the Levenshtein Distance page, for example, there is source code for a few different solutions in Java. The "optimized solution" is tagged with "Translation of: Python". Unfortunately due to differences in how arrays are initialized, the Java translation have a bug difficult to detect. The python code works fine, and the Java code works fine with the provided examples. But the Java version of the algorithm results in incorrect answers for a small subset of strings. One example is ["abcdefgh", "defghabc"] with the correct answer being 6 and the published version resulting in 5.

So, how do I help fix this?

Do I edit the Java translation, fix the bug, and make it a permanent non-translated version? If so, should I somehow still credit the Python version?

I say fix the bug, document why you changed the entry, and probably keep the translation template. I think most people would consider a variation in array initialization (especially to fix a bug!) to be well within the parameters of a translation, as long as the overall idea of the algorithm remains intact. However, it is ultimately your judgement call. If someone feels strongly enough about your edit, they can initiate a discussion about it on your talk page. --Chunes (talk) 19:00, 16 November 2020 (UTC)
Right. I thought for a second that the translation templated indicated an automatic translation and that the translation always should be an exact match, but if I understand correctly that is more of a marker for where the solution came from. Then I'll just add the fix, and comment why on the talk page for the Levenshtein Distance. Caislen (talk) 21:26, 16 November 2020 (UTC)