aligning text with space-normalized text
Steven Bethard
steven.bethard at gmail.com
Thu Jun 30 00:02:22 EDT 2005
John Machin wrote:
> 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']
This doesn't match the (admittedly vague) spec which said that chunks
are created "as if by ' '.join(chunk.split())". For the text:
'foo bar'
the possible chunk lists should be something like:
['foo bar']
['foo', 'bar']
If it helps, you can think of chunks as lists of words, where the words
have been ' '.join()ed.
STeVe
More information about the Python-list
mailing list