Hive UDF with an optimized Levenshtein