469,304 Members | 1,803 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,304 developers. It's quick & easy.

How to parse a list using pyparsing

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
Jul 18 '05 #1
0 1001

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by serpent17 | last post: by
1 post views Thread by Petr Jakes | last post: by
10 posts views Thread by Ernesto | last post: by
8 posts views Thread by jerry.levan | last post: by
10 posts views Thread by Michael B. Trausch | last post: by
9 posts views Thread by martinskou | last post: by
2 posts views Thread by dpw.asdf | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.