{"uid":"cap_bK0gdLnB12coUfHoSBDA_","slug":"damerau-levenshtein-distance-similarity-ef0b9460","name":"Damerau-Levenshtein Distance & Similarity","description":"Damerau-Levenshtein distance — like Levenshtein but also counts adjacent transpositions as a single edit — plus a normalized similarity in [0,1].","url":"https://similarity.openverbs.com/v1/damerau","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["a","b"],"properties":{"a":{"type":"string","maxLength":20000,"description":"First string."},"b":{"type":"string","maxLength":20000,"description":"Second string."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","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.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_y37reotP3H4fyJMVGR3yJ","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes the Damerau-Levenshtein edit distance between two strings (counting insertions, deletions, substitutions, and adjacent transpositions) plus a normalized similarity score in [0,1].","exampleAgentPrompt":"What's the Damerau-Levenshtein distance and normalized similarity between 'recieve' and 'receive'? I want to see if transpositions like that count as a single edit.","exampleUseCases":[{"title":"Spell-checker candidate ranking","prompt":"I have a user-typed word 'accommodaion' and a candidate correction 'accommodation' — can you compute the Damerau-Levenshtein distance and similarity score between them so I can rank it against other candidates?"},{"title":"Duplicate record detection","prompt":"I'm trying to detect near-duplicate names in my database. Can you get the Damerau-Levenshtein similarity between 'Jonathan Smith' and 'Jonathon Smyth' to see how close they are?"},{"title":"Fuzzy search relevance scoring","prompt":"A user searched for 'pytohn' in my code library. Can you compute the Damerau-Levenshtein distance and similarity between 'pytohn' and 'python' so I can decide whether to suggest it as a correction?"}],"resultDescription":"Returns the integer Damerau-Levenshtein edit distance between the two input strings (counting insertions, deletions, substitutions, and adjacent transpositions each as one edit), along with a normalized similarity score in the range [0,1] where 1.0 means the strings are identical and 0.0 means completely dissimilar.","failureModes":["Missing required fields 'a' or 'b' returns a validation error","Strings exceeding 20,000 characters are rejected","Empty string inputs may return distance 0 or the length of the other string depending on implementation","Non-UTF-8 or binary content may cause unexpected results"],"whenToPreferThis":"Choose this endpoint over plain Levenshtein when your use case involves detecting transposition errors (e.g. 'teh' vs 'the', 'recieve' vs 'receive'), which are among the most common human typing mistakes. It is more accurate than standard Levenshtein for spell-checking and OCR correction tasks. Prefer it over Jaro-Winkler or Dice for cases where edit-count semantics matter and you need an integer distance alongside the normalized score. Use Hamming instead only when strings are guaranteed equal length and transpositions are not relevant.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:31:38.436Z","isFirstParty":false}