Sim Diff

Git Repository: https://github.com/kainaw/simdif

simdif is a pure-Python library for computing, comparing, and understanding similarity, difference, and distance metrics. It started as a collection of similarity and difference metrics, and has grown to include distance metrics and alignment scores (Smith-Waterman, Needleman-Wunsch, Affine Gap). The design goal is education first: every metric ships with a step-by-step explanation function and a plain-English definition function so you can see exactly how a score is derived.

⚠️ Not intended for large-scale or production workloads. simdif is pure Python and prioritises clarity over speed. It is well-suited for classroom use, small experiments, and learning how metrics work - not for processing large datasets or performance-critical pipelines.

Highlights

  • 50+ metrics under one unified interface
  • Three input classes: sets, sequences, and vectors
  • Broad input support: plain Python lists, strings, sets, numeric lists, and NumPy / SciPy / TensorFlow arrays/tensors
  • Compare metrics side-by-side by passing a list of metric names to simdif()
  • explain_() - walks through the calculation step by step and returns the score
  • info_() - returns a plain-English definition of the metric
  • Alias-friendly: most metrics have multiple accepted names (e.g. 'dice', 'sorensen', 'dice_sorensen', 'sorensen_dice' all work)
  • Optional fast paths: if a faster library (e.g. python-Levenshtein) is installed, simdif will lazy-import and use it automatically - no configuration needed

Installation

pip install simdif

For development (editable install from a clone):

git clone https://github.com/kainaw/simdif.git
cd simdif
pip install -e .

For syntax and metric lists, see the repo: https://github.com/kainaw/simdif

You've read it. You can't unread it.
Copyright ©1998-2026 C. Shaun Wagner. All rights reserved.