Source: https://guthlabs.ai/docs/instruments/binary-text-diff-similarity-ratio/implementation/

instrument implementation / implementation-contract

# Binary/Text Diff & Similarity Ratio implementation

A source-bound implementation contract for Binary/Text Diff & Similarity Ratio; deployment and executable qualification remain separate.

Status: **VERIFIED_CLEAN**Lifecycle: **implementation-contract**

## Binding contract

This record describes what an executable surface must bind and validate. It does not claim that a public calculator, package, or production route is deployed.

**Record owner**: Guth Instruments

**Lifecycle**: verified-clean

**Evidence ID**: t5-089

**Effect**: Computation or source lookup only

## Input and validation requirements

The specified formula is undefined for two empty text blocks because max(len1,len2)=0, causing division by zero. The result is also convention-sensitive because case handling is unspecified, and the available LCS-based ratio can produce a different score from the Levenshtein formula.

## Required corrections

No binding erratum is attached to this unique-name record. Implementers must still preserve the declared units, domain, and failure behavior.

## Inspectable interface fixture

The sample below is evidence for interface and validation tests, not a production implementation.

````
{
  "inputs": {
    "text1": "cat",
    "text2": "cat"
  },
  "expected_outputs": {
    "edit_distance": 0,
    "similarity_percent": 100,
    "inline_diff": [
      {
        "op": "equal",
        "text": "cat"
      }
    ]
  },
  "working": "len1=3, len2=3; max(3,3)=3. Levenshtein distance=0 because the strings are identical. similarity=1-0/3=1. percent=1*100=100%. Diff: all 3 characters are equal."
}
````

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/binary-text-diff-similarity-ratio/>)[02**Mechanism**](<https://guthlabs.ai/docs/instruments/binary-text-diff-similarity-ratio/mechanism/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/binary-text-diff-similarity-ratio/qualification/>)

## Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

- `VERIFIED_LEDGER.json`

- `evidence-tranche5/tranche5-results.json`
