aligning text with space-normalized text
John Machin
sjmachin at lexicon.net
Wed Jun 29 22:08:56 EDT 2005
Steven Bethard wrote:
[snip]
> And it appears to work:
[snip]
> But it seems somewhat inelegant. Can anyone see an easier/cleaner/more
> Pythonic way[1] of writing this code?
>
> Thanks in advance,
>
> STeVe
>
> [1] Yes, I'm aware that these are subjective terms. I'm looking for
> subjectively "better" solutions. ;)
Perhaps you should define "work" before you worry about """subjectively
"better" solutions""".
If "work" is meant to detect *all* possibilities of 'chunks' not having
been derived from 'text' in the described manner, then it doesn't work
-- all information about the positions of the whitespace is thrown away
by your code.
For example, text = 'foo bar', chunks = ['foobar']
More information about the Python-list
mailing list