2017-02-16 2 views
-1

で強化された++依存認識私が直接nmodを探していることができます:nmodから:のJavaコードで強化++の依存関係の?スタンフォードCoreNLP:Javaの

semanticGraph.getChildrenWithReln(rootToken, UniversalEnglishGrammaticalRelations.NOMINAL_MODIFIER); 

getChildrenWithReln方法の第2のパラメータはGrammaticalRelationを必要とします。 Unfortunatelly、私はのようなものではなく、UniversalEnglishGrammaticalRelations.NOMINAL_MODIFIERしか見つけません。


私の一時的な解決策:

public List<IndexedWord> getChildrenByRelation(IndexedWord root, String shortName, String specific) { 
     final List<SemanticGraphEdge> outputEdges = semanticGraphWrapper.get().getOutEdgesSorted(root); 
     final List<IndexedWord> tokens = new ArrayList<>(); 

     GrammaticalRelation relation; 
     for (SemanticGraphEdge edge : outputEdges) { 
       relation = edge.getRelation(); 
       if (relation.getShortName().equals(shortName) && relation.getSpecific().equals(specific)) 
        tokens.add(edge.getTarget()); 
     } 

     return tokens; 
} 

答えて

1

あなたはedu.stanford.nlp.trees.UniversalEnglishGrammaticalRelations:

public static GrammaticalRelation getNmod(String prepositionString) 

にこの方法を使用して、必要な前置詞を供給します。

関連する問題