title: How to convert coreNLP generated parse tree into data.tree R package
body: <p>I would like the parse tree generated by R package coreNLP into data.tree R package format. The parse tree is generated usng following code:</p>
  
  <pre><code> options( java.parameters = "-Xmx2g" ) 
  library(NLP)
  library(coreNLP)
  #initCoreNLP() # change this if downloaded to non-standard location
  initCoreNLP(annotators = "tokenize,ssplit,pos,lemma,parse")
  ## Some text.
  s &lt;- c("A rare black squirrel has become a regular visitor to a suburban garden.")
  s &lt;- as.String(s)
  
  
  anno&lt;-annotateString(s)
  parse_tree &lt;- getParse(anno)
  parse_tree
  
  The output parse tree is as follows:
  &gt; parse_tree
  [1] "(ROOT\r\n  (S\r\n    (NP (DT A) (JJ rare) (JJ black) (NN squirrel))\r\n    (VP (VBZ has)\r\n      (VP (VBN become)\r\n        (NP (DT a) (JJ regular) (NN visitor))\r\n        (PP (TO to)\r\n          (NP (DT a) (JJ suburban) (NN garden)))))\r\n    (. .)))\r\n\r\n"
  </code></pre>
  
  <p>I found that following posting <a href="https://stackoverflow.com/questions/33473107/visualize-parse-tree-structure/33536291#33536291">Visualize Parse Tree Structure</a>
  .It coverts openNLP package generated parse tree into a tree format. But the parse tree is different from one generated by coreNLP and also solution doesnot convert to data.tree format which i want.</p>
  
  <p><strong>EDIT</strong>
  By adding the 2 lines below we can use the function provided in the posting <a href="https://stackoverflow.com/questions/33473107/visualize-parse-tree-structure/33536291#33536291">Visualize Parse Tree Structure</a></p>
  
  <pre><code># this step modifies coreNLP parse tree to mimic openNLP parse tree
  parse_tree &lt;- gsub("[\r\n]", "", parse_tree)
  parse_tree &lt;- gsub("ROOT", "TOP", parse_tree)
  
  library(igraph)
  library(NLP)
  
  parse2graph(parse_tree,  # plus optional graphing parameters
              title = sprintf("'%s'", x), margin=-0.05,
              vertex.color=NA, vertex.frame.color=NA,
              vertex.label.font=2, vertex.label.cex=1.5, asp=0.5,
              edge.width=1.5, edge.color='black', edge.arrow.size=0)
  </code></pre>
  
  <p>But what i want is to convert the parse tree into <strong>data.tree format</strong> provided by data.tree package</p>