Re: Getting pyparsing to backtrack

2010-07-07 Thread Cousin Stanley
> I'm working on street address parsing again, > and I'm trying to deal with some of the harder cases. > For yet another test case my actual address includes ... East South Mountain Avenue Sometimes written as ... E. South Mtn Ave -- Stanley C. Kitching Human Bei

Re: Getting pyparsing to backtrack

2010-07-06 Thread Thomas Jollans
On 07/06/2010 04:21 AM, Dennis Lee Bieber wrote: > On Mon, 05 Jul 2010 15:19:53 -0700, John Nagle > declaimed the following in gmane.comp.python.general: > >>I'm working on street address parsing again, and I'm trying to deal >> with some of the harder cases. >> > > Hasn't it been sugg

Re: Getting pyparsing to backtrack

2010-07-05 Thread John Nagle
On 7/5/2010 3:19 PM, John Nagle wrote: I'm working on street address parsing again, and I'm trying to deal with some of the harder cases. The approach below works for the cases given. The "Or" operator ("^") supports backtracking, but "Optional()" apparently does not. direction = Combine

Getting pyparsing to backtrack

2010-07-05 Thread John Nagle
I'm working on street address parsing again, and I'm trying to deal with some of the harder cases. Here's a subparser, intended to take in things like "N MAIN" and "SOUTH", and break out the "directional" from street name. Directionals = ['southeast', 'northeast', 'north', 'northwest',