2

私は文章を持っています(テキストI)

トムは頭のいい男の子です。はたくさんのことを知っています。

2番目の文の彼をトムに変更したいので、最後の文は(テキストII)になります:

トムは頭のいい男の子です。トムはたくさんのことを知っています。

私はいくつかのコードを書きましたが、私のcorefオブジェクトは常にnullです。
その上、正しい結果を得るために次に何をすべきかわかりません。

    String text = "Tom is a smart boy. He know a lot of thing.";
    Annotation document = new Annotation(text);
    Properties props = new Properties();
    props.put("annotators", "tokenize, ssplit, pos, parse, lemma, ner, dcoref");
    StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
    pipeline.annotate(document);

    List<Pair<IntTuple, IntTuple>> coref = document.get(CorefGraphAnnotation.class);

私はそれが間違っているかどうか、そしてテキストIからテキストIIを取得するために次に何をすべきかを知りたいです。 PS:私はStanfordCoreNLP1.3.0を使用しています。

ありがとう。

4

1 に答える 1

2
List<Pair<IntTuple, IntTuple>> coref = document.get(CorefGraphAnnotation.class);

これは古いcoref出力形式です。

この行を次のように変更できます

Map<Integer, CorefChain> graph = document.get(CorefChainAnnotation.class);

または、次のoldCorefFormatオプションを使用できます。

props.put("oldCorefFormat", "true");
于 2012-01-08T23:37:38.957 に答える