API Reference

ed.get_diff(a, b)

Computes the difference between two lists of sentences. Takes two lists of strings. For comparing only two sentences, use ed.get_sentence_diff(a, b) instead.

Python

old_sentences, changes, added_lines = ed.get_diff(a, b)

Parameters

a

list[str]

List of sentences in the elder revision.

b

list[str]

List of sentences in the newer revision.

Returns

old_sentences

list[str]

List of sentences of the elder revision.

changes

list[list[[int, str, str]]]

Change set between the elder and the newer revision.

added_lines

list[int]

List of indexes that need to add a new line.

ed.get_sentence_diff(a, b)

Computes the difference between two sentences (rather than two lists of sentences). For chunk-level computation, use ed.get_diff(a, b) instead.

Python

changes = ed.get_sentence_diff(a, b)

Parameters

a

str

The elder revision sentence.

b

str

The newer revision sentence.

Returns

changes

list[[int, str, str]]

Change set between the elder and the newer revision.

The first dimension is the changes in each sentence. Each change is a tuple of three elements: the index of the word, the word in the elder revision, and the word in the newer revision.

© 2025 Lingxi Li.

SF