Program: 53382
Project: 53382
Buggy source:
/** 
 * Output annotation in OpenNLP format.
 * @param kaf the naf document
 * @return the string containing the annotated document
 */
public final String annotateNEsToOpenNLP(KAFDocument kaf){
  StringBuilder sb=new StringBuilder();
  List<Span> allSpans=null;
  List<List<WF>> sentences=kaf.getSentences();
  for (  List<WF> sentence : sentences) {
    String[] tokens=new String[sentence.size()];
    String[] tokenIds=new String[sentence.size()];
    for (int i=0; i < sentence.size(); i++) {
      tokens[i]=sentence.get(i).getForm();
      tokenIds[i]=sentence.get(i).getId();
    }
    if (statistical) {
      Span[] statSpans=nameFinder.nercToSpans(tokens);
      allSpans=Lists.newArrayList(statSpans);
    }
    if (postProcess) {
      Span[] dictSpans=dictFinder.nercToSpansExact(tokens);
      SpanUtils.postProcessDuplicatedSpans(allSpans,dictSpans);
      SpanUtils.concatenateSpans(allSpans,dictSpans);
    }
    if (dictTag) {
      Span[] dictOnlySpans=dictFinder.nercToSpansExact(tokens);
      allSpans=Lists.newArrayList(dictOnlySpans);
    }
    if (lexerFind) {
      String sentenceText=StringUtils.getStringFromTokens(tokens);
      StringReader stringReader=new StringReader(sentenceText);
      BufferedReader sentenceReader=new BufferedReader(stringReader);
      numericLexerFinder=new NumericNameFinder(sentenceReader,nameFactory);
      Span[] numericSpans=numericLexerFinder.nercToSpans(tokens);
      SpanUtils.concatenateSpans(allSpans,numericSpans);
    }
    Span[] allSpansArray=NameFinderME.dropOverlappingSpans(allSpans.toArray(new Span[allSpans.size()]));
    NameSample nameSample=new NameSample(tokens,allSpansArray,false);
    sb.append(nameSample.toString()).append("String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Output annotation in OpenNLP format.
 * @param kaf the naf document
 * @return the string containing the annotated document
 */
public final String annotateNEsToOpenNLP(KAFDocument kaf){
  StringBuilder sb=new StringBuilder();
  List<Span> allSpans=null;
  List<List<WF>> sentences=kaf.getSentences();
  for (  List<WF> sentence : sentences) {
    String[] tokens=new String[sentence.size()];
    String[] tokenIds=new String[sentence.size()];
    for (int i=0; i < sentence.size(); i++) {
      tokens[i]=sentence.get(i).getForm();
      tokenIds[i]=sentence.get(i).getId();
    }
    if (statistical) {
      Span[] statSpans=nameFinder.nercToSpans(tokens);
      allSpans=Lists.newArrayList(statSpans);
    }
    if (postProcess) {
      Span[] dictSpans=dictFinder.nercToSpansExact(tokens);
      SpanUtils.postProcessDuplicatedSpans(allSpans,dictSpans);
      SpanUtils.concatenateSpans(allSpans,dictSpans);
    }
    if (dictTag) {
      Span[] dictOnlySpans=dictFinder.nercToSpansExact(tokens);
      allSpans=Lists.newArrayList(dictOnlySpans);
    }
    if (lexerFind) {
      String sentenceText=StringUtils.getStringFromTokens(tokens);
      StringReader stringReader=new StringReader(sentenceText);
      BufferedReader sentenceReader=new BufferedReader(stringReader);
      numericLexerFinder=new NumericNameFinder(sentenceReader,nameFactory);
      Span[] numericSpans=numericLexerFinder.nercToSpans(tokens);
      SpanUtils.concatenateSpans(allSpans,numericSpans);
    }
    Span[] allSpansArray=NameFinderME.dropOverlappingSpans(allSpans.toArray(new Span[allSpans.size()]));
    NameSample nameSample=new NameSample(tokens,allSpansArray,true);
    sb.append(nameSample.toString());
  }
  return sb.toString();
}