Created
April 19, 2012 12:18
-
-
Save suruja/2420633 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dmp = DiffMatchPatch.new | |
t1 = "Le ciel est bleu et le soleil brille." | |
t2 = "Il pleut sur la ville et le soleil ne brille pas." | |
diffs = dmp.diff_main(t1, t2) | |
dmp.diff_cleanupSemantic(diffs) | |
patchs = dmp.patch_make(t1, diffs) | |
dmp.patch_apply([patchs.first], t1) | |
# => ["Il pleut sur la ville et le soleil brille.", [true]] | |
t1 = "La lune est blonde et le soleil brille." | |
dmp.patch_apply([patchs.first], t1) | |
# TypeError: no implicit conversion from nil to integer | |
# from /home/sebastien/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/diff_match_patch-0.1.0/lib/diff_match_patch.rb:919:in `[]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment