本文整理汇总了Java中edu.stanford.nlp.semgraph.SemanticGraph.addEdge方法的典型用法代码示例。如果您正苦于以下问题:Java SemanticGraph.addEdge方法的具体用法?Java SemanticGraph.addEdge怎么用?Java SemanticGraph.addEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.stanford.nlp.semgraph.SemanticGraph
的用法示例。
在下文中一共展示了SemanticGraph.addEdge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPossConstituent
import edu.stanford.nlp.semgraph.SemanticGraph; //导入方法依赖的package包/类
/** Creates a constituent for a possessive relative clause
* @param semanticGraph The semantic graph
* @param poss The edge referring to the possessive relation
* @param rcmod The relative clause modifier of the relation
* @param constGovernor The root of the constituent
* @param type The type of the constituent
*/
private static Constituent createPossConstituent(SemanticGraph semanticGraph,
SemanticGraphEdge poss, SemanticGraphEdge rcmod, IndexedWord constGovernor, Type type) {
SemanticGraph newSemanticGraph = new SemanticGraph(semanticGraph);
double weight = poss.getWeight();
newSemanticGraph.addEdge(poss.getGovernor(), rcmod.getGovernor(), EnglishGrammaticalRelations.POSSESSION_MODIFIER,
weight, false);
Set<IndexedWord> exclude = DpUtils.exclude(newSemanticGraph, EXCLUDE_RELATIONS_COMPLEMENT, rcmod.getGovernor());
newSemanticGraph.removeEdge(poss);
newSemanticGraph.removeEdge(rcmod);
return new IndexedConstituent(newSemanticGraph, constGovernor, Collections.<IndexedWord> emptySet(), exclude, type);
}