From: pjb@... (Pascal J. Bourguignon) Date: 2009-09-15T23:30:06+09:00 Subject: Re: How to convert an string like this into a tree Object? Possum writes: > recently I'm working on stanford parser(written in java) which has an > in-complete ruby rapper.I can get the result like this as a string , > but I still want to manipulate the result as an tree , what is the > convinient way for me to convert the following string to an tree > object,can someone give me some suggestion? EBADLNG ? Perhaps not... ----(parse-sentence.rb)------------------------------------------------------------ (sexp = "(ROOT (S (S (NP (NP (DT The) (JJS strongest) (NN rain)) (VP (ADVP (RB ever)) (VBN recorded) (PP (IN in) (NP (NNP India))))) (VP (VP (VBD shut) (PRT (RP down)) (NP (NP (DT the) (JJ financial) (NN hub)) (PP (IN of) (NP (NNP Mumbai))))) (, ,) (VP (VBD snapped) (NP (NN communication) (NNS lines))) (, ,) (VP (VBD closed) (NP (NNS airports))) (CC and) (VP (VBD forced) (NP (NP (NNS thousands)) (PP (IN of) (NP (NNS people)))) (S (VP (TO to) (VP (VP (VB sleep) (PP (IN in) (NP (PRP$ their) (NNS offices)))) (CC or) (VP (VB walk) (NP (NN home)) (PP (IN during) (NP (DT the) (NN night)))))))))) (, ,) (NP (NNS officials)) (VP (VBD said) (NP-TMP (NN today))) (. .)))") (code = < parseTree # returns: #, #, #]>, #]>, #, #, #]>]>]>]>, #, #]>, #, #, #]>, #, #]>]>]>]>, #, #, #, #]>]>, #, #, #]>]>, #, #, #]>, #, #]>]>]>, #, #, #, #, #]>]>]>, #, #, #]>, #, #, #]>]>]>]>]>]>]>]>]>, #, #]>, #, #]>]>, #]>]> -- __Pascal Bourguignon__