---
title: LEVENSHTEIN_DISTANCE
url: https://www.tines.com/docs/formulas/functions/levenshtein-distance/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# LEVENSHTEIN_DISTANCE

*[View on tines.com](https://www.tines.com/docs/formulas/functions/levenshtein-distance/)*

Compute the Levenshtein distance between two strings.

**Categories:** Text

## Syntax

```
LEVENSHTEIN_DISTANCE(string_one, string_two, [insertion_cost: 2], [deletion_cost: 2], [substitution_cost: 1])
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "name_one": "Smith",
    "name_two": "Simth"
  }
}
```

Formula:

```
LEVENSHTEIN_DISTANCE(my_action.name_one, my_action.name_two)
```

Output:

```json
2
```

### Example 2

Input:

```json
{
  "my_action": {
    "name_one": "kitten",
    "name_two": "sitting"
  }
}
```

Formula:

```
LEVENSHTEIN_DISTANCE(my_action.name_one, my_action.name_two, insertion_cost: 1, deletion_cost: 1)
```

Output:

```json
3
```

## Sample actions

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "2",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "name_one": "Smith",
          "name_two": "Simth"
        }
      },
      "position": {
        "x": 1845,
        "y": 3225
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "LEVENSHTEIN_DISTANCE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "levenshtein_distance": "=LEVENSHTEIN_DISTANCE(my_action.name_one, my_action.name_two)"
        }
      },
      "position": {
        "x": 1920,
        "y": 3330
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "My Action",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "name_one": "Smith",
          "name_two": "Jones"
        }
      },
      "position": {
        "x": 1995,
        "y": 3225
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    },
    {
      "sourceIdentifier": 2,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
