Program: 131469
Project: 131469
Buggy source:
/** 
 * Runs CKY and populates the chart.
 * @param sent The input sentence.
 * @param grammar The input grammar.
 * @param loopOrder The loop order to use when parsing.
 * @param chart The output chart.
 */
public static final void parseSentence(final int[] sent,final CnfGrammar grammar,final LoopOrder loopOrder,final Chart chart){
  for (int i=0; i <= sent.length - 1; i++) {
    ChartCell cell=chart.getCell(i,i + 1);
    for (    final Rule r : grammar.getLexicalRulesWithChild(sent[i])) {
      double score=r.getScore();
      cell.updateCell(r.getParent(),score,i + 1,r);
    }
  }
  for (int width=1; width <= sent.length; width++) {
    for (int start=0; start <= sent.length - width; start++) {
      int end=start + width;
      ChartCell cell=chart.getCell(start,end);
      if (loopOrder == LoopOrder.CARTESIAN_PRODUCT) {
        processCellCartesianProduct(grammar,chart,start,end,cell);
      }
 else       if (loopOrder == LoopOrder.LEFT_CHILD) {
        processCellLeftChild(grammar,chart,start,end,cell);
      }
 else       if (loopOrder == LoopOrder.RIGHT_CHILD) {
        processCellRightChild(grammar,chart,start,end,cell);
      }
 else {
        throw new RuntimeException("String_Node_Str" + loopOrder);
      }
      ScoresSnapshot scoresSnapshot=cell.getScoresSnapshot();
      int[] nts=cell.getNts();
      for (      final int parentNt : nts) {
        for (        final Rule r : grammar.getUnaryRulesWithChild(parentNt)) {
          double score=r.getScore() + scoresSnapshot.getScore(r.getLeftChild());
          cell.updateCell(r.getParent(),score,end,r);
        }
      }
      cell.close();
    }
  }
}

Fixed version (ground truth):
/** 
 * Runs CKY and populates the chart.
 * @param sent The input sentence.
 * @param grammar The input grammar.
 * @param loopOrder The loop order to use when parsing.
 * @param chart The output chart.
 */
public static final void parseSentence(final int[] sent,final CnfGrammar grammar,final LoopOrder loopOrder,final Chart chart){
  for (int i=0; i <= sent.length - 1; i++) {
    ChartCell cell=chart.getCell(i,i + 1);
    for (    final Rule r : grammar.getLexicalRulesWithChild(sent[i])) {
      double score=r.getScore();
      cell.updateCell(r.getParent(),score,i + 1,r);
    }
  }
  for (int width=1; width <= sent.length; width++) {
    for (int start=0; start <= sent.length - width; start++) {
      int end=start + width;
      ChartCell cell=chart.getCell(start,end);
      if (loopOrder == LoopOrder.CARTESIAN_PRODUCT) {
        processCellCartesianProduct(grammar,chart,start,end,cell);
      }
 else       if (loopOrder == LoopOrder.LEFT_CHILD) {
        processCellLeftChild(grammar,chart,start,end,cell);
      }
 else       if (loopOrder == LoopOrder.RIGHT_CHILD) {
        processCellRightChild(grammar,chart,start,end,cell);
      }
 else {
        throw new RuntimeException("String_Node_Str" + loopOrder);
      }
      ScoresSnapshot scoresSnapshot=cell.getScoresSnapshot();
      int[] nts=cell.getNts();
      for (      final int parentNt : nts) {
        for (        final Rule r : grammar.getUnaryRulesWithChild(parentNt)) {
          double score=r.getScore() + scoresSnapshot.getScore(r.getLeftChild());
          cell.updateCell(r.getParent(),score,end,r);
        }
      }
      if (width == sent.length) {
        scoresSnapshot=cell.getScoresSnapshot();
        nts=cell.getNts();
        for (        final int parentNt : nts) {
          for (          final Rule r : grammar.getUnaryRulesWithChild(parentNt)) {
            double score=r.getScore() + scoresSnapshot.getScore(r.getLeftChild());
            cell.updateCell(r.getParent(),score,end,r);
          }
        }
      }
      cell.close();
    }
  }
}