ではUnsupportedOperationExceptionを得るのですか私はStanford CoreNLP
にTree
から各フレーズ(成分)の頭語を検索したいのですが、私はconstituents
のいずれかのtree.Parent()
をしようとしたとき、私はUnsupportedOperationException
を取得します。私は間違って何をしていますか?ここでは、なぜ私はスタンフォードCoreNLP
は私のコードです:私はparseTree.subTreeList()
のサイズとして13を得る
Your tasks are challenging:
、それらのすべてのために、私が取得:ここ
List<Tree> allConstituents = new ArrayList<>();
private Tree parseTree;
List<CoreMap> sentences = LoadAndParse(language, filetype, modelPath, text);
for (CoreMap sentence : sentences) {
Tree parse = sentence.get(TreeAnnotation.class);
allConstituents = parseTree.subTreeList();
for (int i = 0; i < allConstituents.size(); i++) {
Tree constituentTree = allConstituents.get(i);
HeadFinder headFinder = new SemanticHeadFinder();
String head = constituentTree.headTerminal(headFinder, constituentTree.parent());
}
}
は、私が持っている例です。方法はconstituentTree.parent()
のUnsupportedOperationException
である。誰もが、ツリー内の「すべての」構成要素のセマンティック・ヘッドを得る正しい方法は何ですか?
この問題は、そのタイプの親メソッドは実装されていないようです。スタンフォードCoreNLPに関する文書はありますか? – Stultuske