Levenshtein distance

Supported in: Batch, Streaming

Compute the levenshtein distance between two strings.

Expression categories: String

Declared arguments

  • Ignore case - Do you want to ignore case when comparing the left and right strings?
    Literal<Boolean>
  • Left - Left string to compare.
    Expression<String>
  • Right - Right string to compare.
    Expression<String>

Output type: Integer

Examples

Example 1: Base case

Argument values:

  • Ignore case: false
  • Left: left
  • Right: right
leftrightOutput
hellohello0
hallohello1
hellohEllO2
hellohello, world!8
hellofarewell6

Example 2: Base case

Description: By setting ignore case to true, letters of different case are treated as equal. Argument values:

  • Ignore case: true
  • Left: left
  • Right: right
leftrightOutput
hellohello0
hELlohello0
hellohEllO0

Example 3: Null case

Argument values:

  • Ignore case: false
  • Left: left
  • Right: right
leftrightOutput
hellonullnull
nullhellonull
nullnullnull