2

Am using google-diff-match-patch for comparing 2 strings for Difference. It works fine for most part, except if the first Character in a word is the same.

For Ex:

Text1 = CHICAGO IL
Text2 = COLUMBUS OH

Output:

deltas: [Diff(EQUAL,"C"), Diff(DELETE,"HICAGO IL"), Diff(INSERT,"OLUMBUS OH")]
<span>C</span><span class='SS_ChangeDelete'>HICAGO IL</span><span class='SS_ChangeAdd'>OLUMBUS OH</span>

Desired Output:

deltas: [Diff(DELETE,"CHICAGO IL"), Diff(INSERT,"COLUMBUS OH")]
<span class='SS_ChangeDelete'>CHICAGO IL</span><span class='SS_ChangeAdd'>COLUMBUS OH</span>

Any Suggestions or if there is any other library out there can do the trick ? Thanks in Advance

Ben
  • 195
  • 2
  • 10
  • 1
    What is your program supposed to do? – Philip Brack Nov 08 '17 at 19:50
  • Its Supposed to find Word Difference between 2 sentences and return a merged sentence.For Ex: Text1 = CHICAGO IL Text2 = COLUMBUS OH Expected = Striked(CHICAGO IL) Highlighted(COLUMBUS OH) But am getting : NoChange(C) Striked(HICAGO IL) Highlighted(OLUMBUS OH) – Ben Nov 08 '17 at 20:04
  • @Ben I am facing same issue, were you able to get a solution? If yes, then can you please share. – Neelam Sharma Dec 19 '17 at 13:08
  • @NeelamSharma I still have not got the solution. But the google wiki has some steps to resolve the word diff. Tried it, but did not work for me. https://code.google.com/archive/p/google-diff-match-patch/wikis/LineOrWordDiffs.wiki – Ben Jan 11 '18 at 15:51

0 Answers0