2017-04-14 54 views

回答

2

我们刚刚添加了一个模块来处理这个问题。

您需要从GitHub获取最新的代码。

下面是一些示例代码:

package edu.stanford.nlp.examples; 

import edu.stanford.nlp.coref.*; 
import edu.stanford.nlp.coref.data.*; 
import edu.stanford.nlp.ling.CoreAnnotations; 
import edu.stanford.nlp.util.*; 

import edu.stanford.nlp.pipeline.*; 

import java.util.*; 


public class QuoteAttributionExample { 

    public static void main(String[] args) { 
    Annotation document = 
     new Annotation("John said, \"There's an elephant outside the window.\""); 
    Properties props = new Properties(); 
    props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,entitymentions,quote,quoteattribution"); 
    StanfordCoreNLP pipeline = new StanfordCoreNLP(props); 
    pipeline.annotate(document); 
    for (CoreMap quote : document.get(CoreAnnotations.QuotationsAnnotation.class)) { 
     System.out.println(quote); 
     System.out.println(quote.get(QuoteAttributionAnnotator.MentionAnnotation.class)); 
    } 
    } 
} 

这是仍在开发中,我们可能会添加一些代码,使其更容易得到很快链接到报价的实际文本跨度。