{"uid":"cap_Pk_j5xWp-3xjalrzq0p-f","slug":"text-similarity-levenshtein-damerau-levenshtein-edit-distance-b1fd920c","name":"Text Similarity: Levenshtein & Damerau-Levenshtein Edit Distance","description":"Levenshtein and Damerau-Levenshtein edit distance (restricted and unrestricted) between two texts, with a 0 to 1 similarity.","url":"https://text-similarity.x402tookit.com/edit-distance?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["a","b"],"properties":{"a":{"type":"string","description":"First text, up to 2000 characters"},"b":{"type":"string","description":"Second text, up to 2000 characters"},"ignoreCase":{"type":"boolean","description":"true to compare case-insensitively (default false: Kitten and kitten differ by 1)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"source":{"type":["null","string"]},"lengthA":{"type":["null","number"]},"lengthB":{"type":["null","number"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"damerauOsa":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"ignoreCase":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"similarity":{"type":["null","number"]},"levenshtein":{"type":["null","number"]},"damerauUnrestricted":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_pmbNy0SjOjbcoYh454o-I","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes Levenshtein and Damerau-Levenshtein (restricted OSA and unrestricted) edit distances between two texts, returning a normalized 0–1 similarity score.","exampleAgentPrompt":"Can you compute the Levenshtein and Damerau-Levenshtein edit distances between 'sitting' and 'kitten', and give me a 0-to-1 similarity score? Please compare them case-insensitively.","exampleUseCases":[{"title":"Typo detection in user input","prompt":"I need to check how many character edits separate the user-entered word 'recieve' from the correct spelling 'receive' — can you get the Levenshtein distance and similarity score between those two strings?"},{"title":"Near-duplicate record deduplication","prompt":"We have two company names in our database: 'Acme Corporaton' and 'Acme Corporation' — can you compute the edit distance and normalized similarity between them so I can decide if they're duplicates?"},{"title":"Password change similarity check","prompt":"A user is trying to set a new password 'Sunsh1ne2024!' and their old one was 'Sunshine2024!' — can you get the Levenshtein distance and 0-to-1 similarity between those two strings, case-sensitively?"}],"resultDescription":"Returns Levenshtein distance, Damerau-Levenshtein OSA (restricted) distance, unrestricted Damerau-Levenshtein distance, a normalized 0-to-1 similarity score, lengths of both input strings, and metadata fields including ignoreCase flag, summary, and any degraded/disclaimer notices.","failureModes":["Missing required query parameters 'a' or 'b' returns a validation error","Input strings exceeding 2000 characters may be rejected or truncated","Payment not provided or invalid x402 payment header causes 402 Payment Required","Network timeout if the service is temporarily unavailable","Unexpected characters or encoding issues may cause malformed responses"],"whenToPreferThis":"Choose this endpoint when you need character-level edit distance metrics (Levenshtein or Damerau-Levenshtein) between two texts of up to 2000 characters each, especially for typo detection, fuzzy deduplication, or spell-checking workflows. Prefer it over Jaro/Jaro-Winkler endpoints when you need full edit-distance counts rather than just a similarity ratio, or when transposition handling (Damerau) matters. Use the sibling cosine or Dice endpoints instead for longer texts or word-overlap comparisons.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T12:40:43.027Z","isFirstParty":false,"canonicalSlug":"text-similarity-levenshtein-damerau-levenshtein-edit-distance-b1fd920c"}