Simple Diff Function implemented in Python, PHP, CoffeeScript, and JavaScript
Clone or download
Latest commit 0a35027 Feb 21, 2017

simplediff is an implementation of a diff function similar to Ratcliff/Metzener1

It's not the fastest diff algorithm, but it's simple enough to understand in an afternoon. That said, it's been in use for five years and I've never heard a complaint about performance. There are now four implementations (Python, CoffeeScript, JavaScript, and PHP), all mostly sharing the same interface.

See the Python code for the reference implementation.

The Python version is available through pip:

pip install simplediff

The Javascript version is available through npm:

npm install simplediff

The PHP and Python code was written by me (Paul Butler) in 2007 and 2008 respectively.

The CoffeeScript port was contributed by vjeux (2012).

The JavaScript port was contributed by DJ Mountney (2012).

Python unit tests contributed by Felipe (fmartingr), 2013.

PHP fix contributed by multiwebinc, 2013.

Lua port contributed by Philippe Fremy, 2015.

For more details, see the Python readme

  1. Pattern Matching: The Gestalt Approach