diff-match-patch icon indicating copy to clipboard operation
diff-match-patch copied to clipboard

Different results in the demo and in Python

Open milossramek opened this issue 5 years ago • 2 comments

Hi, I quite often get different results if I call diff-match-patch from python3 by dmp = dmp_module.diff_match_patch() diff = dmp.diff_main(in, out) in comparison to the results provided by the demo from this repository. Usually a large block of text (often the whole text except for a few words at the start and at the end) is marked as one replaced block, while the demo correctly shows many insert/delete/replacement blocks inside it.

Maybe that the javascript implementation used by the demo is different from the installed python version from pypy diff-match-patch==20200713

My strings are in utf-8 and quite often with 10k characters and more in a single line without line breaks. Maybe that this is the problem for the Python implementation.

Any idea, how to solve this problem? thanks in advance Milos

milossramek avatar Jul 14 '20 13:07 milossramek

Hi, Milos I think found the solution for that.

According to library source, that contains 'Diff_Timeout'. I tried this.


diff_obj = diff_match_patch.diff_match_patch() diff_obj.Diff_Timeout = 5

and then, It looks like to solve the problem.

shinhanhwcho avatar Aug 13 '20 01:08 shinhanhwcho

diff_obj.Diff_Timeout = 5

Thanks, this is a lifesaver!

caramdache avatar Nov 18 '20 08:11 caramdache