当前位置: 首页>>代码示例>>Java>>正文


Java SemanticGraphEdge.getRelation方法代码示例

本文整理汇总了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;
}
 
开发者ID:gkiril,项目名称:minie,代码行数:9,代码来源:CoreNLPUtils.java

示例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;
}
 
开发者ID:gkiril,项目名称:minie,代码行数:37,代码来源:MinIE.java


注:本文中的edu.stanford.nlp.semgraph.SemanticGraphEdge.getRelation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。