Program: 31741
Project: 31741
Buggy source:
public void testCrossValidation() throws MauiFilterException {
  String vocabularyPath="String_Node_Str";
  String vocabularyName="String_Node_Str";
  String datasetPath="String_Node_Str";
  int fold=10;
  Stemmer stemmer=new PorterStemmer();
  String language="String_Node_Str";
  String encoding="String_Node_Str";
  Stopwords stopwords=StopwordsFactory.makeStopwords(language);
  Vocabulary vocabulary=new Vocabulary();
  vocabulary.setStemmer(stemmer);
  vocabulary.setLanguage(language);
  vocabulary.setStopwords(stopwords);
  vocabulary.setSerialize(false);
  vocabulary.initializeVocabulary(vocabularyPath,vocabularyName);
  MauiTopicExtractor topicExtractor=new MauiTopicExtractor();
  MauiModelBuilder modelBuilder=new MauiModelBuilder();
  modelBuilder.stemmer=stemmer;
  modelBuilder.stopwords=stopwords;
  modelBuilder.documentLanguage=language;
  modelBuilder.documentEncoding=encoding;
  topicExtractor.stemmer=stemmer;
  topicExtractor.stopwords=stopwords;
  topicExtractor.documentEncoding=encoding;
  topicExtractor.documentLanguage=language;
  modelBuilder.setBasicFeatures(true);
  modelBuilder.setKeyphrasenessFeature(true);
  modelBuilder.setFrequencyFeatures(true);
  modelBuilder.setPositionsFeatures(true);
  modelBuilder.setLengthFeature(true);
  modelBuilder.setThesaurusFeatures(true);
  modelBuilder.setWikipediaFeatures(false);
  modelBuilder.setVocabulary(vocabulary);
  modelBuilder.setVocabularyName(vocabularyName);
  modelBuilder.modelName="String_Node_Str";
  List<MauiDocument> testDocuments=DataLoader.loadTestDocuments(datasetPath);
  int numDocs=testDocuments.size();
  int part=numDocs / fold;
  int startTest, endTest;
  double[] precision=new double[fold];
  double[] recall=new double[fold];
  double[] fmeasure=new double[fold];
  for (int run=1; run <= fold; run++) {
    startTest=(run - 1) * part;
    endTest=startTest + part;
    log.info("String_Node_Str" + run + "String_Node_Str"+ startTest+ "String_Node_Str"+ endTest);
    List<MauiDocument> test=new ArrayList<MauiDocument>();
    List<MauiDocument> train=new ArrayList<MauiDocument>();
    for (int i=0; i < testDocuments.size(); i++) {
      if (i >= startTest && i < endTest) {
        test.add(testDocuments.get(i));
      }
 else {
        train.add(testDocuments.get(i));
      }
    }
    long startTime=System.currentTimeMillis();
    MauiFilter mauiFilter=modelBuilder.buildModel(train);
    long stopTime=System.currentTimeMillis();
    long elapsedTime=stopTime - startTime;
    log.info("String_Node_Str" + elapsedTime + "String_Node_Str");
    topicExtractor.setModel(mauiFilter);
    List<MauiTopics> topics=topicExtractor.extractTopics(test);
    double[] PRF=Evaluator.evaluateTopics(topics);
    precision[run - 1]=PRF[0];
    recall[run - 1]=PRF[1];
    fmeasure[run - 1]=PRF[2];
  }
  double avgRecall=Utils.roundDouble(Utils.mean(recall) * 100,2);
  double avgPrecision=Utils.roundDouble(Utils.mean(precision) * 100,2);
  double avgFmeasure=Utils.roundDouble(Utils.mean(fmeasure) * 100,2);
  log.info("String_Node_Str" + avgPrecision + "String_Node_Str"+ avgRecall+ "String_Node_Str"+ avgFmeasure);
}

Fixed version (ground truth):
public void testCrossValidation() throws MauiFilterException {
  String vocabularyFormat="String_Node_Str";
  String vocabularyPath="String_Node_Str";
  String datasetPath="String_Node_Str";
  int fold=10;
  Stemmer stemmer=new PorterStemmer();
  String language="String_Node_Str";
  String encoding="String_Node_Str";
  Stopwords stopwords=StopwordsFactory.makeStopwords(language);
  Vocabulary vocabulary=new Vocabulary();
  vocabulary.setStemmer(stemmer);
  vocabulary.setLanguage(language);
  vocabulary.setStopwords(stopwords);
  vocabulary.setSerialize(false);
  vocabulary.initializeVocabulary(vocabularyPath,vocabularyFormat);
  MauiTopicExtractor topicExtractor=new MauiTopicExtractor();
  MauiModelBuilder modelBuilder=new MauiModelBuilder();
  modelBuilder.stemmer=stemmer;
  modelBuilder.stopwords=stopwords;
  modelBuilder.documentLanguage=language;
  modelBuilder.documentEncoding=encoding;
  topicExtractor.stemmer=stemmer;
  topicExtractor.stopwords=stopwords;
  topicExtractor.documentEncoding=encoding;
  topicExtractor.documentLanguage=language;
  modelBuilder.setBasicFeatures(true);
  modelBuilder.setKeyphrasenessFeature(true);
  modelBuilder.setFrequencyFeatures(true);
  modelBuilder.setPositionsFeatures(true);
  modelBuilder.setLengthFeature(true);
  modelBuilder.setThesaurusFeatures(true);
  modelBuilder.setWikipediaFeatures(false);
  modelBuilder.setVocabulary(vocabulary);
  modelBuilder.setVocabularyName(vocabularyPath);
  modelBuilder.modelName="String_Node_Str";
  List<MauiDocument> testDocuments=DataLoader.loadTestDocuments(datasetPath);
  int numDocs=testDocuments.size();
  int part=numDocs / fold;
  int startTest, endTest;
  double[] precision=new double[fold];
  double[] recall=new double[fold];
  double[] fmeasure=new double[fold];
  for (int run=1; run <= fold; run++) {
    startTest=(run - 1) * part;
    endTest=startTest + part;
    log.info("String_Node_Str" + run + "String_Node_Str"+ startTest+ "String_Node_Str"+ endTest);
    List<MauiDocument> test=new ArrayList<MauiDocument>();
    List<MauiDocument> train=new ArrayList<MauiDocument>();
    for (int i=0; i < testDocuments.size(); i++) {
      if (i >= startTest && i < endTest) {
        test.add(testDocuments.get(i));
      }
 else {
        train.add(testDocuments.get(i));
      }
    }
    long startTime=System.currentTimeMillis();
    MauiFilter mauiFilter=modelBuilder.buildModel(train);
    long stopTime=System.currentTimeMillis();
    long elapsedTime=stopTime - startTime;
    log.info("String_Node_Str" + elapsedTime + "String_Node_Str");
    topicExtractor.setModel(mauiFilter);
    List<MauiTopics> topics=topicExtractor.extractTopics(test);
    double[] PRF=Evaluator.evaluateTopics(topics);
    precision[run - 1]=PRF[0];
    recall[run - 1]=PRF[1];
    fmeasure[run - 1]=PRF[2];
  }
  double avgRecall=Utils.roundDouble(Utils.mean(recall) * 100,2);
  double avgPrecision=Utils.roundDouble(Utils.mean(precision) * 100,2);
  double avgFmeasure=Utils.roundDouble(Utils.mean(fmeasure) * 100,2);
  log.info("String_Node_Str" + avgPrecision + "String_Node_Str"+ avgRecall+ "String_Node_Str"+ avgFmeasure);
}