Java でスタンフォード ライブラリを使用して依存関係の解析を行っています。依存関係の元の文字列内のインデックスを取り戻す方法はありますか? getSpans() メソッドを呼び出そうとしましたが、すべてのトークンに対して null が返されます。
LexicalizedParser lp = LexicalizedParser.loadModel(
"edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz",
"-maxLength", "80", "-retainTmpSubcategories");
TreebankLanguagePack tlp = new PennTreebankLanguagePack();
GrammaticalStructureFactory gsf = tlp.grammaticalStructureFactory();
Tree parse = lp.apply(text);
GrammaticalStructure gs = gsf.newGrammaticalStructure(parse);
Collection<TypedDependency> tdl = gs.typedDependenciesCollapsedTree();
for(TypedDependency td:tdl)
{
td.gov().getSpan() // it's null!
td.dep().getSpan() // it's null!
}
何か案が?