-1
我可以直接找NMOD:從和NMOD:的在的Java代碼增強++依賴呢?斯坦福CoreNLP:增強++依賴性識別在Java中
semanticGraph.getChildrenWithReln(rootToken, UniversalEnglishGrammaticalRelations.NOMINAL_MODIFIER);
getChildrenWithReln
方法的第二個參數需要GrammaticalRelation
。不幸的是,我發現只有UniversalEnglishGrammaticalRelations.NOMINAL_MODIFIER
而不是像UniversalEnglishGrammaticalRelations.NOMINAL_MODIFIER_FROM
。
我的臨時解決方案:
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;
}