pyspark.sql.functions.levenshtein

pyspark.sql.functions.levenshtein(left: ColumnOrName, right: ColumnOrName) → pyspark.sql.column.Column

Computes the Levenshtein distance of the two given strings.

Examples

>>> df0 = spark.createDataFrame([('kitten', 'sitting',)], ['l', 'r'])
>>> df0.select(levenshtein('l', 'r').alias('d')).collect()
[Row(d=3)]