make sure entire string was parsed

Steven Bethard steven.bethard at gmail.com
Tue Sep 13 12:30:30 EDT 2005


Paul McGuire wrote:
> I still don't know the BNF you are working from

Just to satisfy any curiosity you might have, it's the Penn TreeBank 
format: http://www.cis.upenn.edu/~treebank/
(Except that the actual Penn Treebank data unfortunately differs from 
the format spec in a few ways.)

> 1. I'm surprised func_word does not permit numbers anywhere in the
> body.  Is this just a feature you have not implemented yet?  As long as
> func_word does not start with a digit, you can still define one
> unambiguously to allow numbers after the first character if you define
> func_word as
> 
> func_word = _pp.Word(func_chars,func_chars+_pp.nums)

Ahh, very nice.  The spec's vague, but this is probably what I want to do.

> 2. Is coord an optional sub-element of a func?

No, functions, coord and id are optional sub-elements of the tags string.

> You might also add a default value for coord_tag if none is supplied,
> to simplify your parse action?

Oh, that's nice.  I missed that functionality.

> It's not clear to me what if any further help you are looking for, now
> that your initial question (about StringEnd()) has been answered.

Yes, thanks, you definitely answered the initial question.  And your 
followup commentary was also very helpful.  Thanks again!

STeVe



More information about the Python-list mailing list