title: core-nlp coreference resolution: remaping co-references
body: <p>I have been trying to play with the core-nlp co-reference resolution system. The system works as explained in the tutorial. Below is the code for the same: </p>
  
  <pre><code>public static void main(String[] args) throws Exception {
      Annotation document = new Annotation("Barack Obama was born in Hawaii.  He is the president. Obama was elected in 2008.");
      Properties props = new Properties();
      props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,parse,mention,coref");
      StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
      pipeline.annotate(document);
      System.out.println("---");
      System.out.println("coref chains");
      for (CorefChain cc : document.get(CorefCoreAnnotations.CorefChainAnnotation.class).values()) {
        System.out.println("\t" + cc);
      }
  </code></pre>
  
  <p>which outputs :</p>
  
  <pre><code>CHAIN3-["Barack Obama" in sentence 1, "He" in sentence 1]
  </code></pre>
  
  <p>What I am trying to get is a map which shows </p>
  
  <pre><code>Key | Value
  He : Barack Obama
  Obama: Barack Obama
  </code></pre>
  
  <p>Is there an inbuilt method to achieve this or do I have to post-process this (Not just the Map)?</p>