Skip to content

Main content

Distance: Discrete Symbol Mismatch Cost Tool

Evaluate one discrete symbol equality/mismatch cost with an explicit nonnegative penalty, not edit-distance alignment.

Loading tool…

Description

Return a literal symbol mismatch cost.

Discrete distances depend on the representation of symbols, sets and counts. A local mismatch or count update assumes the surrounding sequence or set bookkeeping is already correct.

Return a literal symbol mismatch cost.

When to use this tool

Use Distance: Discrete Symbol Mismatch Cost when checking a supplied discrete-distance contribution or update.

How to use the tool and how it works

  1. Enter left, right, mismatchCost. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Return a literal symbol mismatch cost. Require mismatchCost >= 0; cost is zero for exact left/right equality, otherwise mismatchCost; equal reports that comparison.1

Input fieldMeaning and unitsAccepted input
leftLeftRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
rightRightRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
mismatchCostMismatch CostRequired. Finite number.
Output fieldInterpretationReturned shape
resultReturned object; expand its named members below.Required. Object.
result.costCostCalculated result member: number.
result.equalEqualCalculated result member: boolean.
json
{
  "input": {
    "left": "a",
    "right": "b",
    "mismatchCost": 2
  },
  "output": {
    "result": {
      "cost": 2,
      "equal": false
    }
  }
}

Limitations and assumptions

  • No case folding, Unicode normalization or semantic equivalence is inferred.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use the full sequences or sets to establish the original distance and actual operation before applying a local update.

References

  1. Calculation and input contract: distance/discrete-symbol-mismatch-cost — tool.io

Similar or alternative tools