Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'library,': 0.05; 'advance,': 0.07; 'targets': 0.07; 'python': 0.08; 'subject:library': 0.09; 'substitution': 0.09; 'library': 0.15; 'discussions,': 0.16; 'algorithm': 0.16; 'possibly': 0.16; 'solution.': 0.19; 'seems': 0.20; 'language': 0.20; 'maybe': 0.22; 'obviously': 0.23; 'versions': 0.23; 'received:209.85.220': 0.25; '(or': 0.25; '(e.g.': 0.25; 'all,': 0.28; 'message- id:@mail.gmail.com': 0.28; 'blocks': 0.30; 'thanks': 0.31; 'subject:?': 0.31; "won't": 0.32; 'does': 0.32; 'rather': 0.33; 'to:addr:python-list': 0.34; 'someone': 0.34; 'app': 0.35; 'probably': 0.35; 'comparing': 0.37; 'some': 0.37; 'but': 0.37; 'several': 0.37; 'using': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'to:addr:python.org': 0.39; 'missing': 0.40; 'received:209': 0.40; 'skip:d 20': 0.40; "i'd": 0.40; 'results': 0.62; 'subject:like': 0.67; 'natural': 0.67; 'special': 0.67; 'texts': 0.73; 'blocks.': 0.84; 'subject:moved': 0.84; 'url:fr': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=ptg69DJmVoOkXEi6zJsN0zO6/ncZ8uMh7KaFTKvefv4=; b=Bv+E2fUAzEp89yyTdMYP2y7AGPi4MoFHK5FECpoDcYwIwwtlVteWdQRBR4ng2pc9xj siyZG8MMhXxmuWr5879obnjWQlQXppqsO40ewBJ2UYdNiabvfn5JhuuqxV3ksvLHKlcJ yPrDmucWOb0lB1xmx7hYtGSmukNoQvr5VXdO0= MIME-Version: 1.0 Date: Wed, 13 Jul 2011 23:13:16 +0200 Subject: difflib-like library supporting moved blocks detection? From: Vlastimil Brom To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310591600 news.xs4all.nl 23844 [2001:888:2000:d::a6]:35887 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9439 Hi all, I'd like to ask about the availability of a text diff library, like difflib, which would support the detection of moved text blocks. Currently I am almost happy with the results of difflib.SequenceMatcher in my app (comparing different versions of natural language texts), however the only drawback seems to be the missing detection of moves of the text parts. I was thinking of simply recomparing the deleted and inserted blocks using difflib again, but this obviously won't be a general solution. I found several algorithm discussions, but unfortunately no suitable python implementation. (E.g. Medite - http://www-poleia.lip6.fr/~ganascia/Medite_Project - seems to be implemented in Python but it targets some rather special and probably much more complex textological issues, than my current needs.) Does maybe someone know such python library (or possibly a way of enhancing difflib) for this task (i.e character-wise comparing of texts - detecting insertion, deletion, substitution and move of text blocks)? Thanks in advance, Vlastimil Brom