public LabeledScoredTreeReaderFactory(TreeNormalizer tm) { lf = CoreLabel.factory(); this.tm = tm; }
/** * Recursively creates an edu.stanford.nlp.trees.Tree from a ROOT annotation It also saves the * whitespaces before and after a token as <code>CoreAnnotation.BeforeAnnotation</code> and <code> * CoreAnnotation.AfterAnnotation</code> in the respective label of the current node. * * @param root the ROOT annotation * @return an {@link Tree} object representing the syntax structure of the sentence */ public static Tree createStanfordTree(Annotation root) { return createStanfordTree(root, new LabeledScoredTreeFactory(CoreLabel.factory())); }
/** Create a new TreeReaderFactory with CategoryWordTag labels. */ public LabeledScoredTreeReaderFactory() { lf = CoreLabel.factory(); tm = new BobChrisTreeNormalizer(); }
/** * Return a <code>TreeFactory</code> that produces trees of the same type as the current <code> * Tree</code>. That is, this implementation, will produce trees of type <code> * LabeledScoredTree(Node|Leaf)</code>. The <code>Label</code> of <code>this</code> is examined, * and providing it is not <code>null</code>, a <code>LabelFactory</code> which will produce that * kind of <code>Label</code> is supplied to the <code>TreeFactory</code>. If the <code>Label * </code> is <code>null</code>, a <code>StringLabelFactory</code> will be used. The factories * returned on different calls a different: a new one is allocated each time. * * @return a factory to produce labeled, scored trees */ @Override public TreeFactory treeFactory() { LabelFactory lf = (label() == null) ? CoreLabel.factory() : label().labelFactory(); return new LabeledScoredTreeFactory(lf); }