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 s
Steve -
Wow, this is a pretty dense pyparsing program. You are really pushing
the envelope in your use of ParseResults, dicts, etc., but pretty much
everything seems to be working.
I still don't know the BNF you are working from, but here are some
other "shots in the dark":
1. I'm surprised fun
Steven Bethard wrote:
> Paul McGuire wrote:
>
I have to differentiate between:
(NP -x-y)
and:
(NP-x -y)
I'm doing this now using Combine. Does that seem right?
>>
>>
>> If your word char set is just alphanums+"-", then this will work
>> without doing anything unnatural
Paul McGuire wrote:
>>>I have to differentiate between:
>>> (NP -x-y)
>>>and:
>>> (NP-x -y)
>>>I'm doing this now using Combine. Does that seem right?
>
> If your word char set is just alphanums+"-", then this will work
> without doing anything unnatural with leaveWhitespace:
>
> from pyparsin
Steve -
>>I have to differentiate between:
>> (NP -x-y)
>>and:
>> (NP-x -y)
>>I'm doing this now using Combine. Does that seem right?
If your word char set is just alphanums+"-", then this will work
without doing anything unnatural with leaveWhitespace:
from pyparsing import *
thing = Word
Paul McGuire wrote:
> Thanks for giving pyparsing a try! To see whether your input text
> consumes the whole string, add a StringEnd() element to the end of your
> BNF. Then if there is more text after the parsed text, parseString
> will throw a ParseException.
Thanks, that's exactly what I was
Steven -
Thanks for giving pyparsing a try! To see whether your input text
consumes the whole string, add a StringEnd() element to the end of your
BNF. Then if there is more text after the parsed text, parseString
will throw a ParseException.
I notice you call leaveWhitespace on several of your
How do I make sure that my entire string was parsed when I call a
pyparsing element's parseString method? Here's a dramatically
simplified version of my problem:
py> import pyparsing as pp
py> match = pp.Word(pp.nums)
py> def parse_num(s, loc, toks):
... n, = toks
... return int(n) + 10