nus-yam/ex-repair huggingface dataset:
Program: 19942
Project: 19942
Buggy source:
/** 
 * Gets the map associated with the given position. Creates the map as necessary.
 * @param position the position of interest
 * @return the map of HMMs for the given position.
 */
private Map getHMMMap(HMMPosition pos){
  Map hmmMap=(Map)hmmsPerPosition[pos.getIndex()];
  if (hmmMap == null) {
    hmmMap=new LinkedHashMap();
    hmmsPerPosition[pos.getIndex()]=hmmMap;
  }
  return hmmMap;
}

Fixed version (ground truth):
/** 
 * Gets the map associated with the given position. Creates the map as necessary.
 * @param pos the position of interest
 * @return the map of HMMs for the given position.
 */
private Map getHMMMap(HMMPosition pos){
  Map hmmMap=(Map)hmmsPerPosition[pos.getIndex()];
  if (hmmMap == null) {
    hmmMap=new LinkedHashMap();
    hmmsPerPosition[pos.getIndex()]=hmmMap;
  }
  return hmmMap;
}
Program: 19943
Project: 19943
Buggy source:
/** 
 * Create buffers for all pools used by the trainer in this pool manager.
 */
protected void createBuffers(){
  meansBufferPool=create1DPoolBuffer(meansPool);
  varianceBufferPool=create1DPoolBuffer(variancePool);
  matrixBufferPool=create2DPoolBuffer(matrixPool);
  mixtureWeightsBufferPool=create1DPoolBuffer(mixtureWeightsPool);
}

Fixed version (ground truth):
/** 
 * Create buffers for all pools used by the trainer in this pool manager.
 */
protected void createBuffers(){
  meansBufferPool=create1DPoolBuffer(meansPool,false);
  varianceBufferPool=create1DPoolBuffer(variancePool,false);
  matrixBufferPool=create2DPoolBuffer(matrixPool,true);
  mixtureWeightsBufferPool=create1DPoolBuffer(mixtureWeightsPool,true);
}
Program: 19944
Project: 19944
Buggy source:
/** 
 * Create buffers for a given pool.
 */
private Pool create2DPoolBuffer(Pool pool){
  Pool bufferPool=new Pool(pool.getName());
  for (int i=0; i < pool.size(); i++) {
    float[][] element=(float[][])pool.get(i);
    int poolSize=element.length;
    Buffer[] bufferArray=new Buffer[poolSize];
    for (int j=0; j < poolSize; j++) {
      bufferArray[j]=new Buffer(element[j].length);
    }
    bufferPool.put(i,bufferArray);
  }
  return bufferPool;
}

Fixed version (ground truth):
/** 
 * Create buffers for a given pool.
 */
private Pool create2DPoolBuffer(Pool pool,boolean isLog){
  Pool bufferPool=new Pool(pool.getName());
  for (int i=0; i < pool.size(); i++) {
    float[][] element=(float[][])pool.get(i);
    int poolSize=element.length;
    Buffer[] bufferArray=new Buffer[poolSize];
    for (int j=0; j < poolSize; j++) {
      bufferArray[j]=new Buffer(element[j].length,isLog);
    }
    bufferPool.put(i,bufferArray);
  }
  return bufferPool;
}
Program: 19945
Project: 19945
Buggy source:
/** 
 * Create buffers for a given pool.
 */
private Pool create1DPoolBuffer(Pool pool){
  Pool bufferPool=new Pool(pool.getName());
  for (int i=0; i < pool.size(); i++) {
    float[] element=(float[])pool.get(i);
    Buffer buffer=new Buffer(element.length);
    bufferPool.put(i,buffer);
  }
  return bufferPool;
}

Fixed version (ground truth):
/** 
 * Create buffers for a given pool.
 */
private Pool create1DPoolBuffer(Pool pool,boolean isLog){
  Pool bufferPool=new Pool(pool.getName());
  for (int i=0; i < pool.size(); i++) {
    float[] element=(float[])pool.get(i);
    Buffer buffer=new Buffer(element.length,isLog);
    bufferPool.put(i,buffer);
  }
  return bufferPool;
}
Program: 19946
Project: 19946
Buggy source:
/** 
 * Normalize the given data
 * @param data the data to normalize
 */
private void normalize(float[] data){
  float sum=0;
  for (int i=0; i < data.length; i++) {
    sum+=data[i];
  }
  if (sum != 0.0f) {
    for (int i=0; i < data.length; i++) {
      data[i]=data[i] / sum;
    }
  }
}

Fixed version (ground truth):
/** 
 * Normalize the given data
 * @param data the data to normalize
 */
private void normalize(float[] data){
  float sum=0;
  for (int i=0; i < data.length; i++) {
    sum+=data[i];
  }
  if (sum != 0.0f) {
    sum=1.0f / sum;
    for (int i=0; i < data.length; i++) {
      data[i]=data[i] * sum;
    }
  }
}
Program: 19948
Project: 19948
Buggy source:
/** 
 * Loads the Sphinx 3 acoustic model properties file, which is basically a normal system properties file.
 * @param props the SphinxProperties object 
 * @param path the path to the acoustic properties file
 * @return a SphinxProperty object containing the acoustic properties,or null if there are no acoustic model properties
 * @throws FileNotFoundException if the file cannot be found
 * @throws IOException if an error occurs while loading the data
 */
private SphinxProperties loadAcousticPropertiesFile(String context,String url) throws FileNotFoundException, IOException {
  SphinxProperties.initContext(context,new URL(url));
  return (SphinxProperties.getSphinxProperties(context));
}

Fixed version (ground truth):
/** 
 * Loads the Sphinx 3 acoustic model properties file, which is basically a normal system properties file.
 * @param context this models' context
 * @param url the path to the acoustic properties file
 * @return a SphinxProperty object containing the acoustic properties,or null if there are no acoustic model properties
 * @throws FileNotFoundException if the file cannot be found
 * @throws IOException if an error occurs while loading the data
 */
private SphinxProperties loadAcousticPropertiesFile(String context,String url) throws FileNotFoundException, IOException {
  SphinxProperties.initContext(context,new URL(url));
  return (SphinxProperties.getSphinxProperties(context));
}
Program: 19949
Project: 19949
Buggy source:
/** 
 * Adds model to the mixture weights
 * @param pool the pool to add models to
 * @param stateID vector containing state ids for hmm
 * @param stream the number of streams
 * @param numGaussiansPerState the number of Gaussians per state
 * @param floor the minimum mixture weight allowed
 * @throws IOException if an error occurs while loading the data
 */
private void addModelToMixtureWeightPool(Pool pool,int[] stateID,int numStreams,int numGaussiansPerState,float floor) throws IOException {
}

Fixed version (ground truth):
/** 
 * Adds model to the mixture weights
 * @param pool the pool to add models to
 * @param stateID vector containing state ids for hmm
 * @param numStreams the number of streams
 * @param numGaussiansPerState the number of Gaussians per state
 * @param floor the minimum mixture weight allowed
 * @throws IOException if an error occurs while loading the data
 */
private void addModelToMixtureWeightPool(Pool pool,int[] stateID,int numStreams,int numGaussiansPerState,float floor) throws IOException {
}
Program: 19950
Project: 19950
Buggy source:
/** 
 * Loads the sphinx3 densityfile, a set of density arrays are created and placed in the given pool.
 * @param path the path to a density file
 * @param name the name of the data
 * @return a pool of loaded densities
 * @throws FileNotFoundException if a file cannot be found
 * @throws IOException if an error occurs while loading the data
 */
private Pool loadHMMPool(boolean useCDUnits,InputStream inputStream,String path) throws FileNotFoundException, IOException {
}

Fixed version (ground truth):
/** 
 * Loads the sphinx3 densityfile, a set of density arrays are created and placed in the given pool.
 * @param useCDUnits if true, loads also the context dependent units
 * @param inputStream the open input stream to use
 * @param path the path to a density file
 * @return a pool of loaded densities
 * @throws FileNotFoundException if a file cannot be found
 * @throws IOException if an error occurs while loading the data
 */
private Pool loadHMMPool(boolean useCDUnits,InputStream inputStream,String path) throws FileNotFoundException, IOException {
}
Program: 19951
Project: 19951
Buggy source:
/** 
 * Loads the Sphinx 3 acoustic model properties file, which is basically a normal system properties file.
 * @param props the SphinxProperties object 
 * @param path the path to the acoustic properties file
 * @return a SphinxProperty object containing the acoustic properties,or null if there are no acoustic model properties
 * @throws FileNotFoundException if the file cannot be found
 * @throws IOException if an error occurs while loading the data
 */
private SphinxProperties loadAcousticPropertiesFile(String context,String url) throws FileNotFoundException, IOException {
  SphinxProperties.initContext(context,new URL(url));
  return (SphinxProperties.getSphinxProperties(context));
}

Fixed version (ground truth):
/** 
 * Loads the Sphinx 3 acoustic model properties file, which is basically a normal system properties file.
 * @param context this models' context
 * @param url the path to the acoustic properties file
 * @return a SphinxProperty object containing the acoustic properties,or null if there are no acoustic model properties
 * @throws FileNotFoundException if the file cannot be found
 * @throws IOException if an error occurs while loading the data
 */
private SphinxProperties loadAcousticPropertiesFile(String context,String url) throws FileNotFoundException, IOException {
  SphinxProperties.initContext(context,new URL(url));
  return (SphinxProperties.getSphinxProperties(context));
}
Program: 19952
Project: 19952
Buggy source:
/** 
 * Loads the Sphinx 3 acoustic model properties file, which is basically a normal system properties file.
 * @param props the SphinxProperties object 
 * @param path the path to the acoustic properties file
 * @param append if true, append to the current file, if ZIP file
 * @throws FileNotFoundException if the file cannot be found
 * @throws IOException if an error occurs while saving the data
 */
private void saveAcousticPropertiesFile(SphinxProperties property,String path,boolean append) throws FileNotFoundException, IOException {
  logger.info("String_Node_Str");
  logger.info(path);
  OutputStream outputStream=StreamFactory.getOutputStream(location,path,append);
  if (outputStream == null) {
    throw new IOException("String_Node_Str" + path);
  }
  PrintStream ps=new PrintStream(outputStream,true);
  property.list(ps);
  outputStream.close();
}

Fixed version (ground truth):
/** 
 * Loads the Sphinx 3 acoustic model properties file, which is basically a normal system properties file.
 * @param property the SphinxProperties object 
 * @param path the path to the acoustic properties file
 * @param append if true, append to the current file, if ZIP file
 * @throws FileNotFoundException if the file cannot be found
 * @throws IOException if an error occurs while saving the data
 */
private void saveAcousticPropertiesFile(SphinxProperties property,String path,boolean append) throws FileNotFoundException, IOException {
  logger.info("String_Node_Str");
  logger.info(path);
  OutputStream outputStream=StreamFactory.getOutputStream(location,path,append);
  if (outputStream == null) {
    throw new IOException("String_Node_Str" + path);
  }
  PrintStream ps=new PrintStream(outputStream,true);
  property.list(ps);
  outputStream.close();
}
Program: 19953
Project: 19953
Buggy source:
/** 
 * Saves the sphinx3 densityfile, a set of density arrays are created and placed in the given pool.
 * @param path the path to a density file
 * @param name the name of the data
 * @throws FileNotFoundException if a file cannot be found
 * @throws IOException if an error occurs while saving the data
 */
private void saveHMMPool(boolean useCDUnits,OutputStream outputStream,String path) throws FileNotFoundException, IOException {
}

Fixed version (ground truth):
/** 
 * Saves the sphinx3 densityfile, a set of density arrays are created and placed in the given pool.
 * @param useCDUnits if true, uses context dependent units
 * @param outputStream the open output stream to use
 * @param path the path to a density file
 * @throws FileNotFoundException if a file cannot be found
 * @throws IOException if an error occurs while saving the data
 */
private void saveHMMPool(boolean useCDUnits,OutputStream outputStream,String path) throws FileNotFoundException, IOException {
}
Program: 19954
Project: 19954
Buggy source:
/** 
 * Creates a LexTreeState.
 * @param leftID the id of the unit forming the left context(or 0 if  there is no left context) of a triphone context
 * @param central the unit forming the central portion of atriphone context
 * @param right the unit forming the right portion of atriphone context
 * @param wordSequence the history of words up until this point
 * @param logProbability the probability (in log math domain)of entering this state.  This is a combination of insertion and language probability.
 */
LexTreeState(int leftID,LexTree.UnitLexNode central,LexTree.UnitLexNode right,WordSequence wordSequence,float logLanguageProbability,float logAcousticProbability,float logInsertionProbability){
  if (leftID == 0) {
    leftID=silenceID;
  }
  this.leftID=leftID;
  this.central=central;
  this.right=right;
  this.wordSequence=wordSequence;
  this.logLanguageProbability=logLanguageProbability * languageWeight;
  this.logAcousticProbability=logAcousticProbability;
  this.logInsertionProbability=logInsertionProbability;
}

Fixed version (ground truth):
/** 
 * Creates a LexTreeState.
 * @param leftID the id of the unit forming the left context(or 0 if  there is no left context) of a triphone context
 * @param central the unit forming the central portion of atriphone context
 * @param right the unit forming the right portion of atriphone context
 * @param wordSequence the history of words up until this point
 * @param logProbability the probability (in log math domain)of entering this state.  This is a combination of insertion and language probability.
 */
LexTreeState(int leftID,LexTree.UnitLexNode central,LexTree.UnitLexNode right,WordSequence wordSequence,float logLanguageProbability,float logAcousticProbability,float logInsertionProbability){
  if (leftID == 0) {
    leftID=silenceID;
  }
  if (central != null && central.getID() == silenceID) {
    leftID=silenceID;
    right=null;
  }
  this.leftID=leftID;
  this.central=central;
  this.right=right;
  this.wordSequence=wordSequence;
  this.logLanguageProbability=logLanguageProbability * languageWeight;
  this.logAcousticProbability=logAcousticProbability;
  this.logInsertionProbability=logInsertionProbability;
}
Program: 19955
Project: 19955
Buggy source:
/** 
 * Retrieves the successors for this node
 * @return the list of successor states
 */
public SearchStateArc[] getSuccessors(){
  LexTree.UnitLexNode nextCentral=getRight();
  if (isFinal()) {
    return EMPTY_ARC;
  }
 else   if (nextCentral == null) {
    return getArcsToAllWords(this);
  }
 else {
    int nextLeftID=getCentral().getID();
    LexTree.LexNode[] nextNodes=getNextUnits(nextCentral);
    SearchStateArc[] nextStates=new SearchStateArc[nextNodes.length + 1];
    for (int i=0; i < nextNodes.length; i++) {
      LexTree.LexNode nextRight=nextNodes[i];
      nextStates[i]=new LexTreeUnitState(nextLeftID,nextCentral,(LexTree.UnitLexNode)nextRight,getWordSequence());
    }
    nextStates[nextStates.length - 1]=createNextWordState(this,finalNode);
    return nextStates;
  }
}

Fixed version (ground truth):
/** 
 * Retrieves the successors for this node
 * @return the list of successor states
 */
public SearchStateArc[] getSuccessors(){
  LexTree.UnitLexNode nextCentral=getRight();
  if (isFinal()) {
    return EMPTY_ARC;
  }
 else   if (nextCentral == null) {
    return getArcsToAllWords(this);
  }
 else {
    int nextLeftID=getCentral().getID();
    LexTree.LexNode[] nextNodes=getNextUnits(nextCentral);
    SearchStateArc[] nextStates=new SearchStateArc[nextNodes.length + 1];
    for (int i=0; i < nextNodes.length; i++) {
      LexTree.LexNode nextRight=nextNodes[i];
      nextStates[i]=new LexTreeUnitState(nextLeftID,nextCentral,(LexTree.UnitLexNode)nextRight,getWordSequence());
    }
    nextStates[nextStates.length - 1]=getEndWord();
    return nextStates;
  }
}
Program: 19956
Project: 19956
Buggy source:
/** 
 * Creates a LexTreeInitialState object
 */
LexTreeInitialState(LexTree.NonLeafLexNode node){
  super(silenceID,null,null,new WordSequence(Dictionary.SENTENCE_START_SPELLING),logOne,logOne,logOne);
  this.node=node;
}

Fixed version (ground truth):
/** 
 * Creates a LexTreeInitialState object
 */
LexTreeInitialState(LexTree.NonLeafLexNode node){
  super(silenceID,null,null,(new WordSequence(Dictionary.SENTENCE_START_SPELLING)).trim(languageModel.getMaxDepth() - 1),logOne,logOne,logOne);
  this.node=node;
}
Program: 19957
Project: 19957
Buggy source:
/** 
 * Gets the arcs to all of the successor nodes
 * @param state the current state
 * @return an array of arcs to the first units of all the wods
 */
SearchStateArc[] getArcsToAllWords(LexTreeState state){
  WordSequence wordSequence=state.getWordSequence();
  int leftID=state.getCentral() == null ? 0 : state.getCentral().getID();
  List list=new ArrayList();
  LexTree.LexNode[] nodes=lexTree.getInitialNode().getNextNodes();
  for (int i=0; i < nodes.length; i++) {
    LexTree.LexNode node=nodes[i];
    if ((node instanceof LexTree.UnitLexNode)) {
      LexTree.UnitLexNode central=(LexTree.UnitLexNode)node;
      if (central.getUnit().isSilence()) {
        list.add(new LexTreeUnitState(leftID,central,null,wordSequence));
      }
 else {
        LexTree.LexNode[] rightNodes=getNextUnits(central);
        for (int j=0; j < rightNodes.length; j++) {
          list.add(new LexTreeUnitState(leftID,central,(LexTree.UnitLexNode)rightNodes[j],wordSequence));
        }
      }
    }
 else {
      throw new Error("String_Node_Str");
    }
  }
  list.add(createNextWordState(state,finalNode));
  return (SearchStateArc[])list.toArray(new SearchStateArc[list.size()]);
}

Fixed version (ground truth):
/** 
 * Gets the arcs to all of the successor nodes
 * @param state the current state
 * @return an array of arcs to the first units of all the wods
 */
SearchStateArc[] getArcsToAllWords(LexTreeState state){
  WordSequence wordSequence=state.getWordSequence();
  int leftID=state.getCentral() == null ? 0 : state.getCentral().getID();
  List list=new ArrayList();
  LexTree.LexNode[] nodes=lexTree.getInitialNode().getNextNodes();
  for (int i=0; i < nodes.length; i++) {
    LexTree.LexNode node=nodes[i];
    if ((node instanceof LexTree.UnitLexNode)) {
      LexTree.UnitLexNode central=(LexTree.UnitLexNode)node;
      if (central.getUnit().isSilence()) {
        list.add(new LexTreeUnitState(leftID,central,null,wordSequence));
      }
 else {
        LexTree.LexNode[] rightNodes=getNextUnits(central);
        for (int j=0; j < rightNodes.length; j++) {
          list.add(new LexTreeUnitState(leftID,central,(LexTree.UnitLexNode)rightNodes[j],wordSequence));
        }
      }
    }
 else {
      throw new Error("String_Node_Str");
    }
  }
  list.add(getEndWord());
  return (SearchStateArc[])list.toArray(new SearchStateArc[list.size()]);
}
Program: 19958
Project: 19958
Buggy source:
public String toString(){
  return super.toString() + "String_Node_Str" + wordLexNode.getPronunciation();
}

Fixed version (ground truth):
public String toString(){
  return "String_Node_Str" + wordLexNode.getPronunciation() + "String_Node_Str"+ super.toString();
}
Program: 19959
Project: 19959
Buggy source:
/** 
 * Given a search state and the next lextree node representing a word, create the new search state with the proper probability.
 * @param curState the current search state
 * @param nextWord the next word in the lex tree
 * @return the arc to the search state associated with the next word
 */
private SearchStateArc createNextWordState(LexTreeState curState,LexTree.WordLexNode nextWord){
  WordSequence wordSequence=curState.getWordSequence();
  float logProbability=logOne;
  if (!nextWord.isSilence()) {
    wordSequence=wordSequence.addWord(nextWord.getPronunciation().getWord(),languageModel.getMaxDepth());
    logProbability=languageModel.getProbability(wordSequence);
    if (false) {
      System.out.println(wordSequence + "String_Node_Str" + logProbability);
    }
  }
  return new LexTreeWordState(curState.getLeftID(),curState.getCentral(),curState.getRight(),wordSequence.trim(languageModel.getMaxDepth() - 1),nextWord,logProbability);
}

Fixed version (ground truth):
/** 
 * Given a search state and the next lextree node representing a word, create the new search state with the proper probability.
 * @param curState the current search state
 * @param nextWord the next word in the lex tree
 * @return the arc to the search state associated with the next word
 */
private SearchStateArc createNextWordState(LexTreeState curState,LexTree.WordLexNode nextWord){
  WordSequence wordSequence=curState.getWordSequence();
  float logProbability=logOne;
  if (!nextWord.isSilence()) {
    wordSequence=wordSequence.addWord(nextWord.getPronunciation().getWord(),languageModel.getMaxDepth());
    logProbability=languageModel.getProbability(wordSequence);
    if (false) {
      System.out.println(wordSequence + "String_Node_Str" + logProbability);
    }
  }
  return new LexTreeWordState(0,curState.getCentral(),curState.getRight(),wordSequence.trim(languageModel.getMaxDepth() - 1),nextWord,logProbability);
}
Program: 19960
Project: 19960
Buggy source:
/** 
 * Constructs a SimpleFrontEnd with the given name, context, acoustic  model name, and DataSource.
 * @param name the name of this SimpleFrontEnd
 * @param context the context of interest
 * @param amName the name of the acoustic model
 * @param dataSource the source of data
 */
public void initialize(String name,String context,String amName,DataSource dataSource) throws IOException {
  SphinxProperties props=SphinxProperties.getSphinxProperties(context);
  boolean useAcousticModelProperties=props.getBoolean(FrontEnd.PROP_USE_ACOUSTIC_MODEL_PROPERTIES,FrontEnd.PROP_USE_ACOUSTIC_MODEL_PROPERTIES_DEFAULT);
  if (useAcousticModelProperties) {
    props=(PropertiesResolver.resolve(props,getAcousticProperties(context,amName),context + "String_Node_Str" + getName()));
  }
  super.initialize(name,context,props,amName,dataSource);
}

Fixed version (ground truth):
/** 
 * Constructs a SimpleFrontEnd with the given name, context, acoustic  model name, and DataSource.
 * @param name the name of this SimpleFrontEnd
 * @param context the context of interest
 * @param amName the name of the acoustic model
 * @param dataSource the source of data
 */
public void initialize(String name,String context,String amName,DataSource dataSource) throws IOException {
  SphinxProperties props=SphinxProperties.getSphinxProperties(context);
  boolean useAcousticModelProperties=props.getBoolean(FrontEnd.PROP_USE_ACOUSTIC_MODEL_PROPERTIES,FrontEnd.PROP_USE_ACOUSTIC_MODEL_PROPERTIES_DEFAULT);
  if (useAcousticModelProperties) {
    props=(PropertiesResolver.resolve(props,getAcousticProperties(context,amName),context + "String_Node_Str" + name));
  }
  super.initialize(name,context,props,amName,dataSource);
}
Program: 19961
Project: 19961
Buggy source:
/** 
 * Adds the given token to the list
 * @param token the token to add
 */
public void add(Token token){
  Class type;
  if (token.getSearchState() instanceof HMMStateState && !token.isEmitting()) {
    type=HMMStateStateNE.class;
  }
 else {
    type=token.getSearchState().getClass();
  }
  ActiveList activeList=findListFor(type);
  if (activeList == null) {
    SimpleActiveList simpleActiveList=new SimpleActiveList(props);
    if (!token.isEmitting()) {
      simpleActiveList.absoluteBeamWidth=absoluteWordBeamWidth;
      simpleActiveList.relativeBeamWidth=relativeWordBeamWidth;
    }
    activeList=simpleActiveList;
    listMap.put(type,activeList);
  }
  activeList.add(token);
}

Fixed version (ground truth):
/** 
 * Adds the given token to the list
 * @param token the token to add
 */
public void add(Token token){
}
Program: 19962
Project: 19962
Buggy source:
/** 
 * Creates active lists with properties
 * @param props the sphinx properties
 */
public SimpleActiveListManager(SphinxProperties props){
  this.props=props;
  absoluteWordBeamWidth=props.getInt(PROP_ABSOLUTE_WORD_BEAM_WIDTH,PROP_ABSOLUTE_WORD_BEAM_WIDTH_DEFAULT);
  double linearRelativeWordBeamWidth=props.getFloat(PROP_RELATIVE_WORD_BEAM_WIDTH,PROP_RELATIVE_WORD_BEAM_WIDTH_DEFAULT);
  LogMath logMath=LogMath.getLogMath(props.getContext());
  relativeWordBeamWidth=logMath.linearToLog(linearRelativeWordBeamWidth);
  listOrder[0]=HMMStateState.class;
  listOrder[1]=HMMStateStateNE.class;
  listOrder[2]=BranchState.class;
  listOrder[3]=PronunciationState.class;
  listOrder[4]=ExtendedUnitState.class;
  listOrder[5]=GrammarState.class;
}

Fixed version (ground truth):
/** 
 * Creates active lists with properties
 * @param props the sphinx properties
 */
public SimpleActiveListManager(SphinxProperties props){
  this.props=props;
  absoluteWordBeamWidth=props.getInt(PROP_ABSOLUTE_WORD_BEAM_WIDTH,PROP_ABSOLUTE_WORD_BEAM_WIDTH_DEFAULT);
  double linearRelativeWordBeamWidth=props.getFloat(PROP_RELATIVE_WORD_BEAM_WIDTH,PROP_RELATIVE_WORD_BEAM_WIDTH_DEFAULT);
  LogMath logMath=LogMath.getLogMath(props.getContext());
  relativeWordBeamWidth=logMath.linearToLog(linearRelativeWordBeamWidth);
}
Program: 19963
Project: 19963
Buggy source:
public ActiveList getNextList(){
  if (listMap.isEmpty()) {
    return null;
  }
  if (listPtr == 6) {
    listPtr=0;
  }
  ActiveList activeList=findListFor(listOrder[listPtr++]);
  if (activeList == null) {
    return getNextList();
  }
  listMap.remove(listOrder[listPtr - 1]);
  return activeList;
}

Fixed version (ground truth):
public ActiveList getNextList(){
  if (listMap.isEmpty()) {
    return null;
  }
  if (listPtr == listOrder.length) {
    listPtr=0;
  }
  ActiveList activeList=findListFor(listOrder[listPtr++]);
  if (activeList == null) {
    return getNextList();
  }
  listMap.remove(listOrder[listPtr - 1]);
  return activeList;
}
Program: 19965
Project: 19965
Buggy source:
/** 
 * Apply the unigram weight to the set of unigrams
 */
private void applyUnigramWeight(){
  float unigramWeight=props.getFloat(LanguageModel.PROP_UNIGRAM_WEIGHT,LanguageModel.PROP_UNIGRAM_WEIGHT_DEFAULT);
  float logUnigramWeight=logMath.linearToLog(unigramWeight);
  float logNotUnigramWeight=logMath.linearToLog(1.0f - unigramWeight);
  float logUniform=logMath.linearToLog(1.0f / (numberUnigrams));
  float p2=logUniform + logNotUnigramWeight;
  for (int i=0; i < numberUnigrams; i++) {
    UnigramProbability unigram=unigrams[i];
    float p1=unigram.getLogProbability();
    if (i != startWordID) {
      p1+=logUnigramWeight;
      p1=logMath.addAsLinear(p1,p2);
    }
    if (applyLanguageWeightAndWip) {
      p1=p1 * languageWeight + wip;
      unigram.setLogBackoff(unigram.getLogBackoff() * languageWeight);
    }
    unigram.setLogProbability(p1);
  }
}

Fixed version (ground truth):
/** 
 * Apply the unigram weight to the set of unigrams
 */
private void applyUnigramWeight(){
  float unigramWeight=props.getFloat(LanguageModel.PROP_UNIGRAM_WEIGHT,LanguageModel.PROP_UNIGRAM_WEIGHT_DEFAULT);
  float logUnigramWeight=logMath.linearToLog(unigramWeight);
  float logNotUnigramWeight=logMath.linearToLog(1.0f - unigramWeight);
  float logUniform=logMath.linearToLog(1.0f / (numberUnigrams));
  float logWip=logMath.linearToLog(wip);
  float p2=logUniform + logNotUnigramWeight;
  for (int i=0; i < numberUnigrams; i++) {
    UnigramProbability unigram=unigrams[i];
    float p1=unigram.getLogProbability();
    if (i != startWordID) {
      p1+=logUnigramWeight;
      p1=logMath.addAsLinear(p1,p2);
    }
    if (applyLanguageWeightAndWip) {
      p1=p1 * languageWeight + logWip;
      unigram.setLogBackoff(unigram.getLogBackoff() * languageWeight);
    }
    unigram.setLogProbability(p1);
  }
}
Program: 19966
Project: 19966
Buggy source:
/** 
 * Reads the probability table from the given DataInputStream.
 * @param stream the DataInputStream from which to read the table
 * @param bigEndian true if the given stream is bigEndian, false otherwise
 */
private float[] readFloatTable(DataInputStream stream,boolean bigEndian) throws IOException {
  int numProbs=readInt(stream,bigEndian);
  if (numProbs <= 0 || numProbs > 65536) {
    throw new Error("String_Node_Str" + numProbs);
  }
  float[] probTable=new float[numProbs];
  if (applyLanguageWeightAndWip) {
    for (int i=0; i < numProbs; i++) {
      probTable[i]=logMath.log10ToLog(readFloat(stream,bigEndian)) * languageWeight + wip;
    }
  }
 else {
    for (int i=0; i < numProbs; i++) {
      probTable[i]=logMath.log10ToLog(readFloat(stream,bigEndian));
    }
  }
  return probTable;
}

Fixed version (ground truth):
/** 
 * Reads the probability table from the given DataInputStream.
 * @param stream the DataInputStream from which to read the table
 * @param bigEndian true if the given stream is bigEndian, false otherwise
 */
private float[] readFloatTable(DataInputStream stream,boolean bigEndian) throws IOException {
  int numProbs=readInt(stream,bigEndian);
  if (numProbs <= 0 || numProbs > 65536) {
    throw new Error("String_Node_Str" + numProbs);
  }
  float[] probTable=new float[numProbs];
  for (int i=0; i < numProbs; i++) {
    probTable[i]=logMath.log10ToLog(readFloat(stream,bigEndian));
  }
  return probTable;
}
Program: 19967
Project: 19967
Buggy source:
/** 
 * Initializes this LanguageModel
 * @param context the context to associate this linguist with
 */
private void initialize(String context) throws IOException {
  this.props=SphinxProperties.getSphinxProperties(context);
  String format=props.getString(LanguageModel.PROP_FORMAT,LanguageModel.PROP_FORMAT_DEFAULT);
  String location=props.getString(LanguageModel.PROP_LOCATION,LanguageModel.PROP_LOCATION_DEFAULT);
  applyLanguageWeightAndWip=props.getBoolean(PROP_APPLY_LANGUAGE_WEIGHT_AND_WIP,PROP_APPLY_LANGUAGE_WEIGHT_AND_WIP_DEFAULT);
  logMath=LogMath.getLogMath(context);
  languageWeight=9.5f;
  wip=logMath.linearToLog(0.7);
  loadBinary(location);
}

Fixed version (ground truth):
/** 
 * Initializes this LanguageModel
 * @param context the context to associate this linguist with
 */
private void initialize(String context) throws IOException {
  this.props=SphinxProperties.getSphinxProperties(context);
  String format=props.getString(LanguageModel.PROP_FORMAT,LanguageModel.PROP_FORMAT_DEFAULT);
  String location=props.getString(LanguageModel.PROP_LOCATION,LanguageModel.PROP_LOCATION_DEFAULT);
  applyLanguageWeightAndWip=props.getBoolean(PROP_APPLY_LANGUAGE_WEIGHT_AND_WIP,PROP_APPLY_LANGUAGE_WEIGHT_AND_WIP_DEFAULT);
  logMath=LogMath.getLogMath(context);
  languageWeight=props.getFloat(Linguist.PROP_LANGUAGE_WEIGHT,Linguist.PROP_LANGUAGE_WEIGHT_DEFAULT);
  wip=(float)props.getDouble(Linguist.PROP_WORD_INSERTION_PROBABILITY,Linguist.PROP_WORD_INSERTION_PROBABILITY_DEFAULT);
  loadBinary(location);
}
Program: 19968
Project: 19968
Buggy source:
/** 
 * Loads the language model from the given location. 
 * @param location the location of the language model
 */
private void loadBinary(String location) throws IOException {
  FileInputStream fis=new FileInputStream(location);
  DataInputStream stream=new DataInputStream(new BufferedInputStream(fis));
  readHeader(stream);
  unigrams=readUnigrams(stream,numberUnigrams + 1,bigEndian);
  skipBigramsTrigrams(stream);
  if (numberBigrams > 0) {
    this.bigramProbTable=readFloatTable(stream,bigEndian);
  }
  if (numberTrigrams > 0) {
    trigramBackoffTable=readFloatTable(stream,bigEndian);
    trigramProbTable=readFloatTable(stream,bigEndian);
    int bigramSegmentSize=1 << logBigramSegmentSize;
    int trigramSegTableSize=((numberBigrams + 1) / bigramSegmentSize) + 1;
    trigramSegmentTable=readIntTable(stream,bigEndian,trigramSegTableSize);
  }
  int wordsStringLength=readInt(stream,bigEndian);
  if (wordsStringLength <= 0) {
    throw new Error("String_Node_Str" + wordsStringLength);
  }
  this.words=readWords(stream,wordsStringLength,numberUnigrams);
  if (startWordID > -1) {
    UnigramProbability unigram=unigrams[startWordID];
    unigram.setLogProbability(-0.99f);
  }
  if (endWordID > -1) {
    UnigramProbability unigram=unigrams[endWordID];
    unigram.setLogProbability(-0.99f);
  }
  applyUnigramWeight();
  fis.close();
  stream.close();
  file=new RandomAccessFile(location,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Loads the language model from the given location. 
 * @param location the location of the language model
 */
private void loadBinary(String location) throws IOException {
  FileInputStream fis=new FileInputStream(location);
  DataInputStream stream=new DataInputStream(new BufferedInputStream(fis));
  readHeader(stream);
  unigrams=readUnigrams(stream,numberUnigrams + 1,bigEndian);
  skipBigramsTrigrams(stream);
  if (numberBigrams > 0) {
    this.bigramProbTable=readFloatTable(stream,bigEndian);
  }
  if (numberTrigrams > 0) {
    trigramBackoffTable=readFloatTable(stream,bigEndian);
    trigramProbTable=readFloatTable(stream,bigEndian);
    int bigramSegmentSize=1 << logBigramSegmentSize;
    int trigramSegTableSize=((numberBigrams + 1) / bigramSegmentSize) + 1;
    trigramSegmentTable=readIntTable(stream,bigEndian,trigramSegTableSize);
  }
  int wordsStringLength=readInt(stream,bigEndian);
  if (wordsStringLength <= 0) {
    throw new Error("String_Node_Str" + wordsStringLength);
  }
  this.words=readWords(stream,wordsStringLength,numberUnigrams);
  if (startWordID > -1) {
    UnigramProbability unigram=unigrams[startWordID];
    unigram.setLogProbability(MIN_PROBABILITY);
  }
  if (endWordID > -1) {
    UnigramProbability unigram=unigrams[endWordID];
    unigram.setLogBackoff(MIN_PROBABILITY);
  }
  applyUnigramWeight();
  fis.close();
  stream.close();
  file=new RandomAccessFile(location,"String_Node_Str");
}
Program: 19969
Project: 19969
Buggy source:
/** 
 * Internal routine used when dumping a Lattice as an AiSee file
 * @param f
 * @throws IOException
 */
void dumpAISee(FileWriter f) throws IOException {
  f.write("String_Node_Str" + fromNode.getId() + "String_Node_Str"+ toNode.getId()+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Internal routine used when dumping a Lattice as an AiSee file
 * @param f
 * @throws IOException
 */
void dumpAISee(FileWriter f) throws IOException {
  f.write("String_Node_Str" + fromNode.getId() + "String_Node_Str"+ toNode.getId()+ "String_Node_Str"+ acousticScore+ "String_Node_Str");
}
Program: 19970
Project: 19970
Buggy source:
/** 
 * Internal routine when dumping Lattices as AiSee files
 * @param f
 * @throws IOException
 */
void dumpAISee(FileWriter f) throws IOException {
  f.write("String_Node_Str" + id + "String_Node_Str"+ getWord()+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Internal routine when dumping Lattices as AiSee files
 * @param f
 * @throws IOException
 */
void dumpAISee(FileWriter f) throws IOException {
  f.write("String_Node_Str" + id + "String_Node_Str"+ getWord()+ "String_Node_Str"+ getId()+ "String_Node_Str"+ getBeginTime()+ "String_Node_Str"+ getEndTime()+ "String_Node_Str");
}
Program: 19972
Project: 19972
Buggy source:
/** 
 * Returns the BigramProbability of the nth follower.
 * @param nthFollower which follower
 * @return the BigramProbability of the nth follower
 */
public final BigramProbability getBigramProbability(int nthFollower){
  int nthPosition=nthFollower * LargeTrigramModel.BYTES_PER_BIGRAM;
  getBuffer().position(nthPosition);
  int wordID=readTwoBytesAsInt();
  int probID=readTwoBytesAsInt();
  int backoffID=readTwoBytesAsInt();
  int firstTrigram=readTwoBytesAsInt();
  getBuffer().position(getBuffer().position() + LargeTrigramModel.BYTES_PER_BIGRAM - 2);
  int nextFirstTrigram=readTwoBytesAsInt();
  return (new BigramProbability(nthFollower,wordID,probID,backoffID,firstTrigram,nextFirstTrigram - firstTrigram));
}

Fixed version (ground truth):
/** 
 * Returns the BigramProbability of the nth follower.
 * @param nthFollower which follower
 * @return the BigramProbability of the nth follower
 */
public final BigramProbability getBigramProbability(int nthFollower){
  int nthPosition=nthFollower * LargeTrigramModel.BYTES_PER_BIGRAM;
  getBuffer().position(nthPosition);
  int wordID=readTwoBytesAsInt();
  int probID=readTwoBytesAsInt();
  int backoffID=readTwoBytesAsInt();
  int firstTrigram=readTwoBytesAsInt();
  return (new BigramProbability(nthFollower,wordID,probID,backoffID,firstTrigram));
}
Program: 19973
Project: 19973
Buggy source:
/** 
 * Constructs a BigramProbability
 * @param which which follower of the first word is this bigram
 * @param wordID the ID of the second word in a bigram
 * @param probabilityID the index into the probability array
 * @param backoffID the index into the backoff probability array
 * @param firstTrigramEntry the first trigram entry
 * @param trigramEntries the number trigram entries for this bigram 
 */
public BigramProbability(int which,int wordID,int probabilityID,int backoffID,int firstTrigramEntry,int trigramEntries){
  this.which=which;
  this.wordID=wordID;
  this.probabilityID=probabilityID;
  this.backoffID=backoffID;
  this.firstTrigramEntry=firstTrigramEntry;
  this.numberTrigramEntries=trigramEntries;
}

Fixed version (ground truth):
/** 
 * Constructs a BigramProbability
 * @param which which follower of the first word is this bigram
 * @param wordID the ID of the second word in a bigram
 * @param probabilityID the index into the probability array
 * @param backoffID the index into the backoff probability array
 * @param firstTrigramEntry the first trigram entry
 * @param trigramEntries the number trigram entries for this bigram 
 */
public BigramProbability(int which,int wordID,int probabilityID,int backoffID,int firstTrigramEntry){
  this.which=which;
  this.wordID=wordID;
  this.probabilityID=probabilityID;
  this.backoffID=backoffID;
  this.firstTrigramEntry=firstTrigramEntry;
}
Program: 19975
Project: 19975
Buggy source:
/** 
 * Initializes this LanguageModel
 * @param context the context to associate this linguist with
 */
private void initialize(String context) throws IOException {
  this.props=SphinxProperties.getSphinxProperties(context);
  String format=props.getString(LanguageModel.PROP_FORMAT,LanguageModel.PROP_FORMAT_DEFAULT);
  String location=props.getString(LanguageModel.PROP_LOCATION,LanguageModel.PROP_LOCATION_DEFAULT);
  logMath=LogMath.getLogMath(context);
  loadBinary(location);
}

Fixed version (ground truth):
/** 
 * Initializes this LanguageModel
 * @param context the context to associate this linguist with
 */
private void initialize(String context) throws IOException {
  this.props=SphinxProperties.getSphinxProperties(context);
  String format=props.getString(LanguageModel.PROP_FORMAT,LanguageModel.PROP_FORMAT_DEFAULT);
  String location=props.getString(LanguageModel.PROP_LOCATION,LanguageModel.PROP_LOCATION_DEFAULT);
  applyLanguageWeightAndWip=props.getBoolean(PROP_APPLY_LANGUAGE_WEIGHT_AND_WIP,PROP_APPLY_LANGUAGE_WEIGHT_AND_WIP_DEFAULT);
  logMath=LogMath.getLogMath(context);
  loadBinary(location);
}
Program: 19976
Project: 19976
Buggy source:
/** 
 * Returns the ID of the given word.
 * @param word the word to find the ID
 * @return the ID of the word
 */
private final int getWordID(String word){
  Integer integer=(Integer)unigramIDMap.get(word);
  if (integer == null) {
    throw new IllegalArgumentException("String_Node_Str" + word);
  }
 else {
    return integer.intValue();
  }
}

Fixed version (ground truth):
/** 
 * Returns the ID of the given word.
 * @param word the word to find the ID
 * @return the ID of the word
 */
private final int getWordID(String word){
  Integer integer=(Integer)unigramIDMap.get(word.toLowerCase());
  if (integer == null) {
    throw new IllegalArgumentException("String_Node_Str" + word);
  }
 else {
    return integer.intValue();
  }
}
Program: 19977
Project: 19977
Buggy source:
/** 
 * Called before a recognition
 */
public void start(){
}

Fixed version (ground truth):
/** 
 * Called before a recognition
 */
public void start(){
  loadedBigramBuffer.clear();
  loadedTrigramBuffer.clear();
  trigramCache.clear();
}
Program: 19978
Project: 19978
Buggy source:
/** 
 * Loads into a buffer all the trigram followers of the given bigram.
 * @param firstWordID the ID of the first word
 * @param secondWordID the ID of the second word
 * @return a TrigramBuffer of all the trigram followers of thegiven two words
 */
private TrigramBuffer loadTrigramBuffer(int firstWordID,int secondWordID){
  TrigramBuffer trigramBuffer=null;
  BigramProbability bigram=findBigram(firstWordID,secondWordID);
  int b=unigrams[firstWordID].getFirstBigramEntry();
  b+=bigram.getWhichFollower();
  int firstTrigramEntry=trigramSegmentTable[b >> loader.getLogBigramSegmentSize()] + bigram.getFirstTrigramEntry();
  long position=(long)(loader.getTrigramOffset() + (firstTrigramEntry * BYTES_PER_TRIGRAM));
  int size=bigram.getNumberTrigramEntries() * BYTES_PER_TRIGRAM;
  try {
    ByteBuffer buffer=loader.loadBuffer(position,size);
    trigramBuffer=new TrigramBuffer(buffer,bigram.getNumberTrigramEntries());
  }
 catch (  IOException ioe) {
    ioe.printStackTrace();
    throw new Error("String_Node_Str");
  }
  return trigramBuffer;
}

Fixed version (ground truth):
/** 
 * Loads into a buffer all the trigram followers of the given bigram.
 * @param firstWordID the ID of the first word
 * @param secondWordID the ID of the second word
 * @return a TrigramBuffer of all the trigram followers of thegiven two words
 */
private TrigramBuffer loadTrigramBuffer(int firstWordID,int secondWordID){
  TrigramBuffer trigramBuffer=null;
  BigramProbability bigram=findBigram(firstWordID,secondWordID);
  if (bigram != null) {
    int numberTrigrams=0, size=0;
    long position=0;
    try {
      int b1=unigrams[firstWordID].getFirstBigramEntry();
      b1+=bigram.getWhichFollower();
      int b2=b1 + 1;
      BigramProbability nextBigram=loader.loadBigram(b2).getBigramProbability(0);
      int firstTrigramEntry=trigramSegmentTable[b1 >> loader.getLogBigramSegmentSize()] + bigram.getFirstTrigramEntry();
      int nextFirstTrigramEntry=trigramSegmentTable[b2 >> loader.getLogBigramSegmentSize()] + nextBigram.getFirstTrigramEntry();
      position=(long)(loader.getTrigramOffset() + (firstTrigramEntry * BYTES_PER_TRIGRAM));
      numberTrigrams=nextFirstTrigramEntry - firstTrigramEntry;
      size=numberTrigrams * BYTES_PER_TRIGRAM;
      ByteBuffer buffer=loader.loadBuffer(position,size);
      trigramBuffer=new TrigramBuffer(buffer,numberTrigrams);
    }
 catch (    IOException ioe) {
      ioe.printStackTrace();
      throw new Error("String_Node_Str");
    }
catch (    IllegalArgumentException iae) {
      String[] words=loader.getWords();
      System.out.println(words[firstWordID] + "String_Node_Str" + words[secondWordID]+ "String_Node_Str"+ numberTrigrams+ "String_Node_Str"+ position+ "String_Node_Str"+ size);
      iae.printStackTrace();
    }
  }
  return trigramBuffer;
}
Program: 19979
Project: 19979
Buggy source:
/** 
 * Finds or loads the trigram probability of the given trigram.
 * @param wordSequence the trigram to load
 * @return a TrigramProbability of the given trigram
 */
private TrigramProbability findTrigram(WordSequence wordSequence){
  WordSequence oldest=wordSequence.getOldest();
  TrigramBuffer trigramBuffer=(TrigramBuffer)loadedTrigramBuffer.get(oldest);
  int thirdWordID=getWordID(wordSequence.getWord(2));
  if (trigramBuffer == null) {
    int firstWordID=getWordID(wordSequence.getWord(0));
    int secondWordID=getWordID(wordSequence.getWord(1));
    trigramBuffer=loadTrigramBuffer(firstWordID,secondWordID);
    loadedTrigramBuffer.put(oldest,trigramBuffer);
  }
  return trigramBuffer.findTrigram(thirdWordID);
}

Fixed version (ground truth):
/** 
 * Finds or loads the trigram probability of the given trigram.
 * @param wordSequence the trigram to load
 * @return a TrigramProbability of the given trigram
 */
private TrigramProbability findTrigram(WordSequence wordSequence){
  WordSequence oldest=wordSequence.getOldest();
  TrigramBuffer trigramBuffer=(TrigramBuffer)loadedTrigramBuffer.get(oldest);
  int thirdWordID=getWordID(wordSequence.getWord(2));
  if (trigramBuffer == null) {
    int firstWordID=getWordID(wordSequence.getWord(0));
    int secondWordID=getWordID(wordSequence.getWord(1));
    trigramBuffer=loadTrigramBuffer(firstWordID,secondWordID);
    if (trigramBuffer != null) {
      loadedTrigramBuffer.put(oldest,trigramBuffer);
    }
 else {
      return null;
    }
  }
  return trigramBuffer.findTrigram(thirdWordID);
}
Program: 19980
Project: 19980
Buggy source:
/** 
 * Returns the unigram probability of the given unigram.
 * @param wordSequence the unigram word sequence
 * @return the unigram probability
 */
private float getUnigramProbability(WordSequence wordSequence){
  String unigram=wordSequence.getWord(0);
  Integer unigramID=(Integer)unigramIDMap.get(unigram);
  if (unigramID == null) {
    throw new Error("String_Node_Str" + unigram);
  }
 else {
    UnigramProbability probability=unigrams[unigramID.intValue()];
    return probability.getLogProbability();
  }
}

Fixed version (ground truth):
/** 
 * Returns the unigram probability of the given unigram.
 * @param wordSequence the unigram word sequence
 * @return the unigram probability
 */
private float getUnigramProbability(WordSequence wordSequence){
  String unigram=wordSequence.getWord(0);
  Integer unigramID=(Integer)unigramIDMap.get(unigram);
  if (unigramID == null) {
    unigram="String_Node_Str";
    unigramID=(Integer)unigramIDMap.get(unigram);
    if (unigramID == null) {
      throw new Error("String_Node_Str" + unigram);
    }
  }
  UnigramProbability probability=unigrams[unigramID.intValue()];
  return probability.getLogProbability();
}
Program: 19982
Project: 19982
Buggy source:
/** 
 * Returns the unigram probability of the given unigram.
 * @param wordSequence the unigram word sequence
 * @return the unigram probability
 */
private float getBigramProbability(WordSequence wordSequence){
  String firstWord=wordSequence.getWord(0);
  String secondWord=wordSequence.getWord(1);
  if (loader.getNumberBigrams() <= 0 || firstWord == null) {
    return getUnigramProbability(wordSequence.getNewest());
  }
  if (!hasUnigram(secondWord)) {
    secondWord="String_Node_Str";
  }
  int firstWordID=getWordID(firstWord);
  int secondWordID=getWordID(secondWord);
  BigramProbability bigram=findBigram(firstWordID,secondWordID);
  if (bigram != null) {
    return bigramProbTable[bigram.getProbabilityID()];
  }
 else {
    return (unigrams[firstWordID].getLogBackoff() + unigrams[secondWordID].getLogProbability());
  }
}

Fixed version (ground truth):
/** 
 * Returns the unigram probability of the given unigram.
 * @param wordSequence the unigram word sequence
 * @return the unigram probability
 */
private float getBigramProbability(WordSequence wordSequence){
  String firstWord=wordSequence.getWord(0);
  String secondWord=wordSequence.getWord(1);
  if (loader.getNumberBigrams() <= 0 || firstWord == null) {
    return getUnigramProbability(wordSequence.getNewest());
  }
  if (getUnigram(secondWord) == null) {
    throw new Error("String_Node_Str" + secondWord);
  }
  int firstWordID=getWordID(firstWord);
  int secondWordID=getWordID(secondWord);
  BigramProbability bigram=findBigram(firstWordID,secondWordID);
  if (bigram != null) {
    return bigramProbTable[bigram.getProbabilityID()];
  }
 else {
    return (unigrams[firstWordID].getLogBackoff() + unigrams[secondWordID].getLogProbability());
  }
}
Program: 19983
Project: 19983
Buggy source:
/** 
 * Returns the ID of the given word.
 * @param word the word to find the ID
 * @return the ID of the word
 */
private final int getWordID(String word){
  UnigramProbability probability=(UnigramProbability)unigramIDMap.get(word.toLowerCase());
  if (probability == null) {
    throw new IllegalArgumentException("String_Node_Str" + word);
  }
 else {
    return probability.getWordID();
  }
}

Fixed version (ground truth):
/** 
 * Returns the ID of the given word.
 * @param word the word to find the ID
 * @return the ID of the word
 */
private final int getWordID(String word){
  UnigramProbability probability=getUnigram(word);
  if (probability == null) {
    throw new IllegalArgumentException("String_Node_Str" + word);
  }
 else {
    return probability.getWordID();
  }
}