/** * Converts basic UD tree to enhanced UD graph. */ private static SemanticGraph convertBasicToEnhanced(SemanticGraph sg) { GrammaticalStructure gs = semanticGraphToGrammaticalStructure(sg); return SemanticGraphFactory.generateEnhancedDependencies(gs); }
private void setDependencyTree(Annotation anno) { List<CoreMap> sentences = anno.get(SentencesAnnotation.class); for(CoreMap sentence : sentences) { Tree tree = sentence.get(TreeAnnotation.class); if (tree==null) continue; SemanticGraph deps = null; SemanticGraph basicDeps = null; if (options.lang == Locale.CHINESE) { final boolean threadSafe = true; deps = SemanticGraphFactory.makeFromTree( new ChineseGrammaticalStructure(tree, Filters.acceptFilter(), chineseHeadFinder), SemanticGraphFactory.Mode.COLLAPSED, GrammaticalStructure.Extras.NONE, null); basicDeps = SemanticGraphFactory.makeFromTree( new ChineseGrammaticalStructure(tree, Filters.acceptFilter(), chineseHeadFinder), SemanticGraphFactory.Mode.BASIC, GrammaticalStructure.Extras.NONE, null); } else { deps = SemanticGraphFactory.generateEnhancedDependencies(tree); basicDeps = SemanticGraphFactory.generateUncollapsedDependencies(tree); } sentence.set(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class, basicDeps); sentence.set(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation.class, deps); } }
SemanticGraph uncollapsedDeps = SemanticGraphFactory.generateUncollapsedDependencies(gsf.newGrammaticalStructure(tree), extras); SemanticGraph ccDeps = SemanticGraphFactory.generateCCProcessedDependencies(gsf.newGrammaticalStructure(tree), extras); SemanticGraph enhancedDeps = SemanticGraphFactory.generateEnhancedDependencies(gsf.newGrammaticalStructure(tree)); SemanticGraph enhancedPlusPlusDeps = SemanticGraphFactory.generateEnhancedPlusPlusDependencies(gsf.newGrammaticalStructure(tree));
/** * Converts basic UD tree to enhanced UD graph. */ private static SemanticGraph convertBasicToEnhanced(SemanticGraph sg) { GrammaticalStructure gs = semanticGraphToGrammaticalStructure(sg); return SemanticGraphFactory.generateEnhancedDependencies(gs); }
/** * Converts basic UD tree to enhanced UD graph. */ private static SemanticGraph convertBasicToEnhanced(SemanticGraph sg) { GrammaticalStructure gs = semanticGraphToGrammaticalStructure(sg); return SemanticGraphFactory.generateEnhancedDependencies(gs); }
private void setDependencyTree(Annotation anno) { List<CoreMap> sentences = anno.get(SentencesAnnotation.class); for(CoreMap sentence : sentences) { Tree tree = sentence.get(TreeAnnotation.class); if (tree==null) continue; SemanticGraph deps = null; SemanticGraph basicDeps = null; if (options.lang == Locale.CHINESE) { final boolean threadSafe = true; deps = SemanticGraphFactory.makeFromTree( new ChineseGrammaticalStructure(tree, Filters.acceptFilter(), chineseHeadFinder), SemanticGraphFactory.Mode.COLLAPSED, GrammaticalStructure.Extras.NONE, null); basicDeps = SemanticGraphFactory.makeFromTree( new ChineseGrammaticalStructure(tree, Filters.acceptFilter(), chineseHeadFinder), SemanticGraphFactory.Mode.BASIC, GrammaticalStructure.Extras.NONE, null); } else { deps = SemanticGraphFactory.generateEnhancedDependencies(tree); basicDeps = SemanticGraphFactory.generateUncollapsedDependencies(tree); } sentence.set(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class, basicDeps); sentence.set(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation.class, deps); } }
SemanticGraph uncollapsedDeps = SemanticGraphFactory.generateUncollapsedDependencies(gsf.newGrammaticalStructure(tree), extras); SemanticGraph ccDeps = SemanticGraphFactory.generateCCProcessedDependencies(gsf.newGrammaticalStructure(tree), extras); SemanticGraph enhancedDeps = SemanticGraphFactory.generateEnhancedDependencies(gsf.newGrammaticalStructure(tree)); SemanticGraph enhancedPlusPlusDeps = SemanticGraphFactory.generateEnhancedPlusPlusDependencies(gsf.newGrammaticalStructure(tree));
SemanticGraph uncollapsedDeps = SemanticGraphFactory.generateUncollapsedDependencies(gsf.newGrammaticalStructure(tree), extras); SemanticGraph ccDeps = SemanticGraphFactory.generateCCProcessedDependencies(gsf.newGrammaticalStructure(tree), extras); SemanticGraph enhancedDeps = SemanticGraphFactory.generateEnhancedDependencies(gsf.newGrammaticalStructure(tree)); SemanticGraph enhancedPlusPlusDeps = SemanticGraphFactory.generateEnhancedPlusPlusDependencies(gsf.newGrammaticalStructure(tree));