List of usage examples for edu.stanford.nlp.trees LabeledScoredTreeFactory newTreeNode
@Override
public Tree newTreeNode(Label parentLabel, List<Tree> children)
From source file:qmul.util.treekernel.Production.java
License:Open Source License
public Production(String bnf) { String[] fields = bnf.trim().split(Pattern.quote(SEPARATOR)); if (fields.length < 2) { throw new RuntimeException("too few BNF fields " + bnf); }//w ww .j a va2s .c o m LabeledScoredTreeFactory tf = new LabeledScoredTreeFactory(); ArrayList<Tree> children = new ArrayList<Tree>(); for (int i = 1; i < fields.length; i++) { children.add(tf.newLeaf(fields[i])); } node = tf.newTreeNode(fields[0], children); setBnf(); if (!this.bnf.equals(bnf)) { throw new RuntimeException("BNFs not equal: " + bnf + " vs " + this.bnf); } }