static public Tree<String> stringToTree(String line, String LP, String RP) {
	    String[] parts = line.trim().split("\\s+");    
	    Tree<String> ret = null;
	    Stack<Tree<String>> parents = new Stack<Tree<String>>();
	    for (String word : parts) {
	      Tree<String> parent = null;

	      if (!parents.empty()) parent = parents.peek();

	      if (word.equals(LP)) {
	        Tree<String> tr = new Tree<String>("");
	        if (parent!=null) {
	          // add tr to the current parent, stupid Tree doesn't have addChild API!
	          List<Tree<String>> children = parent.getChildren();
	          List<Tree<String>> newChildren = new ArrayList<Tree<String>>(children);
	          newChildren.add(tr);
	          parent.setChildren(newChildren);
	        }
	        parents.push(tr);
	        continue;
	      } 
	       
	      if (word.equals(RP)) {
	        ret = parents.pop();
	        continue;
	      }
	      
	      parent.setLabel(word);
	    }
	    return ret;
	  }