How to parse a list using pyparsing
From: Nitin Madnani (nmadnani_at_wam.umd.edu)
Date: 07/31/04
- Next message: Peter Otten: "Re: Question on lists"
- Previous message: Sam Holden: "Re: IronPython-0.6 is now available!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Jul 2004 22:27:29 -0700
Hi Guys
I am using pyparsing to parse transformation rules for my natural
language processing application. The rules also have structure to
them, i.e., a rule might look like:
[ A [ B ] ] <--> [ C [ D ] ]
where A, B, C, D are nodes in the rule (although they are usually much
more complex than this)
I have figured out how to parse the nodes out of the rules and return
them like this:
[ [ A, B ], [ C, D ] ]
but I would like to return them in a list with the same hierarchical
structure as in the original rule, i.e., I would like to return:
[ [ A, [ B ] ] , [ C, [ D ] ] ]
I hope that makes sense. Any advice is much appreciated.
Thanks !
Nitin
- Next message: Peter Otten: "Re: Question on lists"
- Previous message: Sam Holden: "Re: IronPython-0.6 is now available!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]