google / diff-match-patch

Diff Match Patch is a high-performance library in multiple languages that manipulates plain text.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different results in the demo and in Python

milossramek opened this issue · 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

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.

diff_obj.Diff_Timeout = 5

Thanks, this is a lifesaver!