private Tree<String> buildTagTree(List<String> words, List<String> tags, int currentPosition) { Tree<String> leafTree = new Tree<String>(words.get(currentPosition)); Tree<String> tagTree = new Tree<String>(tags.get(currentPosition), Collections.singletonList(leafTree)); return tagTree; }
private Tree<String> addRoot(Tree<String> tree) { return new Tree<String>("ROOT", Collections.singletonList(tree)); }