Questions tagged [google-diff-match-patch]

Diff, Match and Patch libraries for Plain Text

The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text.

  1. Diff:
    • Compare two blocks of plain text and efficiently return a list of differences.
    • Diff Demo
  2. Match:
    • Given a search string, find its best fuzzy match in a block of plain text. Weighted for both accuracy and location.
    • Match Demo
  3. Patch:
    • Apply a list of patches onto plain text. Use best-effort to apply patch even when the underlying text doesn't match.
    • Patch Demo

Currently available in Java, JavaScript, Dart, C++, C#, Objective C, Lua and Python. Regardless of language, each library features the same API and the same functionality. All versions also have comprehensive test harnesses.

40 questions
1
vote
1 answer

Why Diff-match-patch broken linediff beyond 65K lines

I try using The google diff-match-path library for line diffs: https://github.com/google/diff-match-patch/wiki/Line-or-Word-Diffs. I get wrong patches when in sum the lines of both inputs goes beyond 65,536 (2^16) lines. Is that a bug (in my code or…
tkruse
  • 10,222
  • 7
  • 53
  • 80
1
vote
0 answers

TextFile Comparer in C# using DiffMatchPatch trimming leading spaces issue

I was using https://github.com/google/diff-match-patch in my C# project to compare text files. Dump the difference into html and send it as an email body to my mail in case when difference was found. The way I'm using is the following: var dump =…
Max Skliar
  • 61
  • 2
  • 9
1
vote
2 answers

Comparison of HTML String & highlight the difference

Problem statement: Two input string with styling like strong,li,ol,line-through etc in HTML. In the screen, there should be two box : Original Text & Edited Text. If any text of original Text is missing in Edited Text then it should highlight that…
Pranav Kumar
  • 79
  • 3
  • 17
1
vote
0 answers

google-diff-match-patch - wrong word diff

I have 2 words "50g" and "75g" and using DiffMatchPatch showing that "5" and "g" is identical. Its suppose only "g" is identical. This url you can test above words and it show the same…
Sh4m
  • 1,424
  • 12
  • 30
1
vote
1 answer

I am unable to compare two text files using library from Google, called diff_match_patch

I am trying to compare the two text files using library from Google, called diff_match_patch in HTML and Javascript. But I am unable to get the difference between two text files. I am using the following code to compare the text.
1
vote
1 answer

google-diff-match-patch failing at runtime with java.lang.NoClassDefFoundError

I am trying to use google-diff-match-patch, getting a NoClassDefFoundError on diff_match_patch$Diff when I run the following code. import name.fraser.neil.plaintext.diff_match_patch.Diff; import…
Adam D
  • 414
  • 4
  • 9
1
vote
1 answer

Efficient way to store tuples of diff info without redundancy

I have this main text How can I run java script from a local folder? this diff.diff_main(diff(), "How can I run java script from a local folder?","How can I run Javascript from a local folder?") returns [(0, 'How can I run '), (-1, 'j'), (1, 'J'),…
0
votes
0 answers

NoClassDefFoundError while using diff-match-patch dependency

I used diff-match-patch dependency in my maven project. org.bitbucket.cowwoc diff-match-patch 1.2 Then i created JAR of my project, tried to run,…
ritik jain
  • 540
  • 1
  • 5
  • 13
0
votes
0 answers

How to get Index numbers while using diff-match-patch in java?

I am using google's diff-match-patch in java for finding differences in two strings. String s1 = "Comment, Version, Message Type, Action, USI prefix, USI Value, Primary Asset"; String s2 = "Comment, Version, Message Type, Action, USI prefix, JPY…
ritik jain
  • 540
  • 1
  • 5
  • 13
0
votes
0 answers

Java: Calculate difference between two strings

I'm trying to calculate difference between two strings and I'm using diff match patch google library. As long as I used java 8 it works well. Now I need to migrate to java 17 and the performance of the library are really bad. I tried to externalise…
Luca
  • 321
  • 1
  • 3
  • 16
0
votes
0 answers

Compare words not character in diff match patch using C#

Text1 = Hello World Text2 = Hi Planet Current output: Diff(EQUAL,"H")Diff(DELETE,"ello World")Diff(INSERT,"i Planet") Desired Output: Diff(DELETE,"Hello World")Diff(INSERT,"Hi Planet") The current code is giving output comparing character to…
0
votes
1 answer

Retrieve Line Numbers from Diff Patch Match

I am working on a project that compares two large text file versions (around 5000+ lines of text). The newer version contains potentially new and removed content. It is intended to help detect early changes in text versions as a team receives…
JamaicaBot
  • 13
  • 4
0
votes
1 answer

diff_match_patch google library is not working as expected in C#

I am writing the text change tracking add-in and my code is: mDiffMatchPatch = new diff_match_patch() List diffList = mDiffMatchPatch.diff_main(OriginalText, ModifiedText); …
Leon
  • 165
  • 12
0
votes
1 answer

Ignore EOL Unix and Windows in Google Diff Match Patch while generating patches

I'm trying to compare two text files one is Windows(CR\LF) and the other is Unix(LF). Both the files when opened in comparer tools like Beyond Compare are showing same although the file size bytes are different. Is there a way to make Google DMP…
0
votes
0 answers

i am using DiffMatchPatch-Library and I want to know on which line in my file the change was found

internal void diffmatchfunc(string newtext, string oldtext) { diff_match_patch dmp = new diff_match_patch(); var listDiff = dmp.diff_main(newtext,oldtext,true); dmp.diff_cleanupEfficiency(listDiff); …