本文整理汇总了Java中edu.stanford.nlp.semgraph.SemanticGraphEdge.getRelation方法的典型用法代码示例。如果您正苦于以下问题:Java SemanticGraphEdge.getRelation方法的具体用法?Java SemanticGraphEdge.getRelation怎么用?Java SemanticGraphEdge.getRelation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.stanford.nlp.semgraph.SemanticGraphEdge
的用法示例。
在下文中一共展示了SemanticGraphEdge.getRelation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: semanticGraphUniversalEnglishToEnglish
import edu.stanford.nlp.semgraph.SemanticGraphEdge; //导入方法依赖的package包/类
public static SemanticGraph semanticGraphUniversalEnglishToEnglish(SemanticGraph semanticGraph) {
for (SemanticGraphEdge edge: semanticGraph.edgeListSorted()) {
GrammaticalRelation oldRel = edge.getRelation();
edge.setRelation(EnglishGrammaticalRelations.shortNameToGRel.get(oldRel.getShortName()));
}
return semanticGraph;
}
示例2: detectClauseModifier
import edu.stanford.nlp.semgraph.SemanticGraphEdge; //导入方法依赖的package包/类
/**
* Given an annotated proposition, check if it contains a clause modifier as an object. If so, return 'true', else
* return 'false'
* @param proposition: annotated proposition
* @return: 'true' if the object is a clause modifier; 'false' otherwise
*/
public boolean detectClauseModifier(ObjectArrayList<AnnotatedPhrase> proposition){
/*for (IndexedWord word: proposition.get(1).getWordList()){
if (word.index() == -2)
continue;
if (this.sentenceSemGraph.getParent(word) != null){
SemanticGraphEdge edge = this.sentenceSemGraph.getEdge(this.sentenceSemGraph.getParent(word), word);
if ((edge.getRelation() == EnglishGrammaticalRelations.SUBJECT) ||
(edge.getRelation() == EnglishGrammaticalRelations.NOMINAL_SUBJECT) ||
(edge.getRelation() == EnglishGrammaticalRelations.CLAUSAL_SUBJECT) ||
(edge.getRelation() == EnglishGrammaticalRelations.NOMINAL_PASSIVE_SUBJECT)){
return true;
}
}
}*/
if (CoreNLPUtils.verbInList(proposition.get(2).getWordList())){
for (IndexedWord word: proposition.get(2).getWordList()){
if (this.sentenceSemGraph.getParent(word) != null){
SemanticGraphEdge edge = this.sentenceSemGraph.getEdge(this.sentenceSemGraph.getParent(word), word);
if ((edge.getRelation() == EnglishGrammaticalRelations.SUBJECT) ||
(edge.getRelation() == EnglishGrammaticalRelations.NOMINAL_SUBJECT) ||
(edge.getRelation() == EnglishGrammaticalRelations.CLAUSAL_SUBJECT) ||
(edge.getRelation() == EnglishGrammaticalRelations.NOMINAL_PASSIVE_SUBJECT)){
return true;
}
}
}
}
return false;
}