我是对的(句子中父母和孩子的提取是否正确。)
String sentence = "Kumi is the girl who likes dogs.";
Tree parse = lp.parse(sentence);
SemanticGraph graph = SemanticGraphFactory.makeFromTree(parse);
IndexedWord wordConnective = graph.getNodeByIndexSafe(i);//i is the index of the word
List<IndexedWord> parentWords = graph.getParentList(wordConnective);
List<IndexedWord> childWord = graph.getChildList(wordConnective);
如果我想在这句话中提取谁的头,我该怎么办?
答案 0 :(得分:0)
使用simple API的简单解决方案可能是:
new Sentence("Kumi is the girl who likes dogs").governor(4);