A very basic string diffing library for comparison of sentences.
The primary purpose of the library, was to help me with a particular diffing-problem, where the existing gems did not give me what I wanted.
A welcome by-product was the chance to learn a bit about comparing strings :)
- Require the file "StringDiffer.rb"
- diff = StringDiffer::SentenceDiff.new("sentence a", "sentence b")
- "diff.differences" now contains the character positions where the sentences differ
See "manual_tests.rb" for complete examples.
The diff is based on a home-brewn algorithm.
- The sentences are split into words, which are then compared
- The words that differ are then compared character-by-character