List of usage examples for edu.stanford.nlp.trees EnglishGrammaticalStructure EnglishGrammaticalStructure
public EnglishGrammaticalStructure(List<TypedDependency> projectiveDependencies, TreeGraphNode root)
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; }