• Documentation
  • Ergodiff
  • Get Started

Get Started

What is Ergodiff?

Ergodiff is a library for generating word-based difference patterns. It uses python built-in difflib as a base sequence matcher, but is acting totally different from difflib, which only gives character-level differences. It is designed to consider only word-level changes, to be suitable for explanation, ignoring whitespaces, and to be able to generate difference patterns for large articles.

Installation

Ergodiff is released on PyPI. You can install it with pip:

pip install ergodiff

Manual Installation

To install Ergodiff manually (not using PyPI), you need to have the distribution package file locally. You can download it from the releases page. Then, you can install it using the following command (with correct version number):

pip install ergodiff-0.2.14-py3-none-any.whl

Quick Start

To use Ergodiff, you need to import the ergodiff module:

from ergodiff import Ergodiff

Then, you can create an instance of Ergodiff:

ed = Ergodiff()
💡

We are not storing anything inside the instance, so feel free to re-use them!

You can use the ed instance to generate the difference between two sentences:

sentence_a = "The quick brown fox jumps over the lazy dog."
sentence_b = "A team of quiet brown foxes jump over the lazy dog."
ed.get_sentence_diff(sentence_a, sentence_b)

For more details, please refer to the API References.

Last updated on December 8, 2022