[melbourne-pug] Code review comments for next issue of The Python Papers
Tennessee Leeuwenburg
tleeuwenburg at gmail.com
Sun Jun 17 00:33:24 CEST 2007
Hi Paul,
Welcome to the list.
Thanks for that word-splitting code. I will try that.
The algorithm I used for the longest common substring was adapted from, I
think, the wikipedia algorithm in the first place, so they're probably a
pretty similar implementation! I just adapted it to use words instead of
characters which wasn't too complex, then used it to build the tree
structure for showing differences.
In the article, I will of course attribute both that source and this list.
Cheers,
-T
On 6/16/07, Paul Holt <pcholt at gmail.com> wrote:
>
> Hi guys - first time posting to the mailing list for me.
>
> Short background:
> I've been programming professionally for ooh quite a while now. Lately
> I've
> been writing under the Django framework for intranet projects at Hawker
> deHavilland. I sent Richard Jones a joystick patch for Bouncy the Hungry
> Rabbit and he put me on to this list. So... hi!
>
> 1.
> Regular expression code to match only whole words:
>
> def __init__(self, string1,string2, depth=0, re_separator="[^\w]*")
> ...
> import re
> wordMatch = re.compile(re_separator)
> self.string1 = ' '.join(wordMatch.split(string1))
> self.string2 = ' '.join(wordMatch.split(string2))
> ...
>
> 2.
> There's some sample python code here:
>
> http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_subsequence
> ...haven't had time to compare implementations.
> _______________________________________________
> melbourne-pug mailing list
> melbourne-pug at python.org
> http://mail.python.org/mailman/listinfo/melbourne-pug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/melbourne-pug/attachments/20070617/a1ed3053/attachment.htm
More information about the melbourne-pug
mailing list