Program: 131691
Project: 131691
Buggy source:
public IndexedDmvModel(DmvTrainCorpus corpus){
  this.sentences=corpus.getSentences();
  this.alphabet=sentences.getLabelAlphabet();
  this.vocab=sentences.getVocab();
  numTags=vocab.size() - 1;
  log.trace("String_Node_Str" + numTags);
  rhsToC=new Alphabet<Rhs>();
  rhsToC.startGrowth();
  rhsToC.lookupObject(new Rhs(ROOT));
  for (int p=0; p < numTags; p++)   for (int dir=0; dir < 2; dir++)   for (int cv=0; cv < childValency; cv++)   rhsToC.lookupObject(new Rhs(CHILD,p,dir,cv));
  for (int p=0; p < numTags; p++)   for (int dir=0; dir < 2; dir++)   for (int dv=0; dv < decisionValency; dv++)   rhsToC.lookupObject(new Rhs(DECISION,p,dir,dv));
  rhsToC.stopGrowth();
  log.trace("String_Node_Str" + rhsToC.size() + "String_Node_Str"+ rhsToC);
  int[][][] sentMaxFreqCm=new int[sentences.size()][][];
  for (int s=0; s < sentences.size(); s++) {
    sentMaxFreqCm[s]=getSentMaxFreqCm(sentences.get(s));
  }
  sentParamToI=new ArrayList<Alphabet<ParamId>>();
  for (int s=0; s < sentences.size(); s++) {
    Alphabet<ParamId> paramToI=new Alphabet<ParamId>();
    for (int c=0; c < getNumConds(); c++) {
      Rhs rhs=rhsToC.lookupIndex(c);
      for (int m=0; m < getNumParams(c); m++) {
        if (sentMaxFreqCm[s][c][m] > 0) {
          paramToI.lookupObject(new ParamId(rhs,m));
        }
      }
    }
    paramToI.stopGrowth();
    sentParamToI.add(paramToI);
    log.trace("String_Node_Str" + s + "String_Node_Str"+ paramToI.size()+ "String_Node_Str"+ paramToI);
  }
  sentCmToI=new ArrayList<Alphabet<CM>>();
  for (int s=0; s < sentences.size(); s++) {
    Alphabet<ParamId> paramToI=sentParamToI.get(s);
    Alphabet<CM> cmToI=new Alphabet<CM>();
    for (int i=0; i < paramToI.size(); i++) {
      ParamId p=paramToI.lookupIndex(i);
      Rhs rhs=p.get1();
      int m=p.get2();
      cmToI.lookupObject(new CM(rhsToC.lookupObject(rhs),m));
    }
    cmToI.stopGrowth();
    sentCmToI.add(cmToI);
    log.trace("String_Node_Str" + s + "String_Node_Str"+ cmToI.size()+ "String_Node_Str"+ cmToI);
  }
  sentMaxFreqSi=new int[sentences.size()][];
  for (int s=0; s < sentences.size(); s++) {
    sentMaxFreqSi[s]=new int[getNumSentVars(s)];
    for (int c=0; c < getNumConds(); c++) {
      for (int m=0; m < getNumParams(c); m++) {
        if (sentMaxFreqCm[s][c][m] > 0) {
          int i=getSi(s,c,m);
          sentMaxFreqSi[s][i]=sentMaxFreqCm[s][c][m];
        }
      }
    }
  }
  numTotalParams=0;
  for (int c=0; c < getNumConds(); c++) {
    for (int m=0; m < getNumParams(c); m++) {
      numTotalParams++;
    }
  }
  numNZUnsupMaxFreqCms=0;
  unsupMaxTotFreqCm=new int[getNumConds()][];
  for (int c=0; c < getNumConds(); c++) {
    unsupMaxTotFreqCm[c]=new int[getNumParams(c)];
    for (int m=0; m < getNumParams(c); m++) {
      for (int s=0; s < sentMaxFreqSi.length; s++) {
        if (!corpus.isLabeled(s)) {
          unsupMaxTotFreqCm[c][m]+=sentMaxFreqCm[s][c][m];
        }
      }
      if (unsupMaxTotFreqCm[c][m] > 0) {
        numNZUnsupMaxFreqCms++;
      }
    }
  }
}

Fixed version (ground truth):
public IndexedDmvModel(DmvTrainCorpus corpus){
  this.sentences=corpus.getSentences();
  this.alphabet=sentences.getLabelAlphabet();
  this.vocab=sentences.getVocab();
  numTags=alphabet.size();
  log.trace("String_Node_Str" + numTags);
  rhsToC=new Alphabet<Rhs>();
  rhsToC.startGrowth();
  rhsToC.lookupObject(new Rhs(ROOT));
  for (int p=0; p < numTags; p++)   for (int dir=0; dir < 2; dir++)   for (int cv=0; cv < childValency; cv++)   rhsToC.lookupObject(new Rhs(CHILD,p,dir,cv));
  for (int p=0; p < numTags; p++)   for (int dir=0; dir < 2; dir++)   for (int dv=0; dv < decisionValency; dv++)   rhsToC.lookupObject(new Rhs(DECISION,p,dir,dv));
  rhsToC.stopGrowth();
  log.trace("String_Node_Str" + rhsToC.size() + "String_Node_Str"+ rhsToC);
  int[][][] sentMaxFreqCm=new int[sentences.size()][][];
  for (int s=0; s < sentences.size(); s++) {
    sentMaxFreqCm[s]=getSentMaxFreqCm(sentences.get(s));
  }
  sentParamToI=new ArrayList<Alphabet<ParamId>>();
  for (int s=0; s < sentences.size(); s++) {
    Alphabet<ParamId> paramToI=new Alphabet<ParamId>();
    for (int c=0; c < getNumConds(); c++) {
      Rhs rhs=rhsToC.lookupIndex(c);
      for (int m=0; m < getNumParams(c); m++) {
        if (sentMaxFreqCm[s][c][m] > 0) {
          paramToI.lookupObject(new ParamId(rhs,m));
        }
      }
    }
    paramToI.stopGrowth();
    sentParamToI.add(paramToI);
    log.trace("String_Node_Str" + s + "String_Node_Str"+ paramToI.size()+ "String_Node_Str"+ paramToI);
  }
  sentCmToI=new ArrayList<Alphabet<CM>>();
  for (int s=0; s < sentences.size(); s++) {
    Alphabet<ParamId> paramToI=sentParamToI.get(s);
    Alphabet<CM> cmToI=new Alphabet<CM>();
    for (int i=0; i < paramToI.size(); i++) {
      ParamId p=paramToI.lookupIndex(i);
      Rhs rhs=p.get1();
      int m=p.get2();
      cmToI.lookupObject(new CM(rhsToC.lookupObject(rhs),m));
    }
    cmToI.stopGrowth();
    sentCmToI.add(cmToI);
    log.trace("String_Node_Str" + s + "String_Node_Str"+ cmToI.size()+ "String_Node_Str"+ cmToI);
  }
  sentMaxFreqSi=new int[sentences.size()][];
  for (int s=0; s < sentences.size(); s++) {
    sentMaxFreqSi[s]=new int[getNumSentVars(s)];
    for (int c=0; c < getNumConds(); c++) {
      for (int m=0; m < getNumParams(c); m++) {
        if (sentMaxFreqCm[s][c][m] > 0) {
          int i=getSi(s,c,m);
          sentMaxFreqSi[s][i]=sentMaxFreqCm[s][c][m];
        }
      }
    }
  }
  numTotalParams=0;
  for (int c=0; c < getNumConds(); c++) {
    for (int m=0; m < getNumParams(c); m++) {
      numTotalParams++;
    }
  }
  numNZUnsupMaxFreqCms=0;
  unsupMaxTotFreqCm=new int[getNumConds()][];
  for (int c=0; c < getNumConds(); c++) {
    unsupMaxTotFreqCm[c]=new int[getNumParams(c)];
    for (int m=0; m < getNumParams(c); m++) {
      for (int s=0; s < sentMaxFreqSi.length; s++) {
        if (!corpus.isLabeled(s)) {
          unsupMaxTotFreqCm[c][m]+=sentMaxFreqCm[s][c][m];
        }
      }
      if (unsupMaxTotFreqCm[c][m] > 0) {
        numNZUnsupMaxFreqCms++;
      }
    }
  }
}