title: How to group up NER tags in order to get data from sentence as a whole?
body: <p>Through the CoreNLP library, upon calling <code>ner()</code> on a <code>CoreLabel</code> I receive a string indicating its named entity tag (such as <code>PERSON</code> or <code>DATE</code>).</p>
  
  <p>However, I know of no way of comparing tokens in a sentence against each other. For example: (text of tokens surrounded in backticks)</p>
  
  <pre><code>`Ellen` PERSON
  `Wexler `PERSON
  `,` O
  `February` DATE
  `9` DATE
  `,` DATE
  `2016` DATE
  </code></pre>
  
  <p><strong>Through CoreNLP, How do I group up the person tags in order to get the name <code>Ellen Wexler</code>? Or the date tags in order to get <code>February 9, 2016</code>, or another representation that I could eventually turn into a Date/Calendar object in Java?</strong> I have looked at the example given <a href="https://stanfordnlp.github.io/CoreNLP/api.html" rel="nofollow noreferrer">here</a>, however that only finds the ner tags for each individual core label. It does not provide me a way to group consecutive, identical ner tags together.</p>
  
  <p><strong>What I have tried:</strong>
  I have written a for loop that iterates over the sentence and finds X number of consecutive, identical ner tags (so if X is 2 and the ner tag is <code>PERSON</code>, it will find 2 consecutive PERSONs). In this scenario, that is <code>Ellen Wexler</code>. However, this breaks down when punctuation comes into play, as punctuation, depending on context, is given the ner tag of its adjacent tokens. In addition, there must be some way to do this through CoreNLP.</p>
  
  <p><strong>My Resarch</strong>:
  <a href="https://stackoverflow.com/questions/45349957/merge-consecutive-tokens-with-same-ner-tag-in-corenlp-conll-output">This</a> similar question has not been answered. The CoreNLP home page provides no answer, as it only provides an example regarding analysis of individual core labels/tokens. </p>