Example usage for edu.stanford.nlp.trees EnglishGrammaticalStructure EnglishGrammaticalStructure

List of usage examples for edu.stanford.nlp.trees EnglishGrammaticalStructure EnglishGrammaticalStructure

Introduction

In this page you can find the example usage for edu.stanford.nlp.trees EnglishGrammaticalStructure EnglishGrammaticalStructure.

Prototype

public EnglishGrammaticalStructure(List<TypedDependency> projectiveDependencies, TreeGraphNode root) 

Source Link

Document

Used for postprocessing CoNLL X dependencies

Usage

From source file:edu.nus.comp.nlp.stanford.UtilParser.java

License:Open Source License

public static Tree getDepTree(Tree parseTree) {
    //Dependencies, punctuations included
    GrammaticalStructure gs = new EnglishGrammaticalStructure(parseTree,
            new PennTreebankLanguagePack().punctuationWordAcceptFilter());
    Collection<TypedDependency> tdl = gs.typedDependencies(); // typedDependenciesCollapsed() eats the prepositions, etc
    gs = new EnglishGrammaticalStructure(parseTree);
    tdl.addAll(gs.typedDependencies());/*w ww. j  a va 2  s . com*/
    Tree depTree = makeTreeRobust(tdl);
    return depTree;
}

From source file:Engines.Test.StanfordParser.TreeHandling.java

License:Open Source License

public static Collection<TypedDependency> getDeps(Tree parseTree) {
    //Dependencies, punctuations included 
    GrammaticalStructure gs = new EnglishGrammaticalStructure(parseTree,
            new PennTreebankLanguagePack().punctuationWordAcceptFilter());
    Collection<TypedDependency> tdl = gs.typedDependencies(); // typedDependenciesCollapsed() eats the prepositions, etc 
    gs = new EnglishGrammaticalStructure(parseTree);
    tdl.addAll(gs.typedDependencies());/*from ww  w .ja v  a  2s .c o m*/
    return tdl;
}