public ValidateResult performCrossValidation(Corpus originalCorpus, int crossValidationCount, File resultFolder, double threshold) throws Exceptions.SRLException, IOException, InterruptedException {
		System.out.println("--- Start cross validation ---");
		System.out.println("--- - FoldCount: " + crossValidationCount);

		ValidateResult result = new ValidateResult();
		long startTime = System.currentTimeMillis();
		originalCorpus.setThreshold(threshold);
		Corpus[] splittedCorpora = Corpus.splitCorpus(originalCorpus, crossValidationCount);

		String folderName = new Date().toString().replace(":", "-");
		File currentCrossValidationFolder = new File(resultFolder.getAbsolutePath() + File.separatorChar + folderName);
		currentCrossValidationFolder.mkdir();

		ValidateResult[] singleResults = new ValidateResult[crossValidationCount];

		for (int i = 0; i < crossValidationCount; i++) {
			System.gc();
			Thread.sleep(5000);

			File foldFolder = new File(currentCrossValidationFolder.getAbsolutePath() + File.separatorChar + "Fold " + (i + 1));
			foldFolder.mkdir();

			startTime = System.currentTimeMillis();
			System.out.print("--- -- generate training corpus " + (i + 1) + "... ");
			Corpus trainCorpus = new Corpus();

			for (int j = 0; j < crossValidationCount; j++) {
				if (j != i || crossValidationCount == 1) {
					trainCorpus.addSentences(splittedCorpora[j].getSentences());
				}
			}
			System.out.println((System.currentTimeMillis() - startTime) + "ms");

			/*startTime = System.currentTimeMillis();
			System.out.print("--- -- write training corpus to file " + (i + 1) + "... ");
			trainCorpus.writeCorpusToFile(foldFolder.getAbsolutePath() + File.separatorChar + "trainCorpus" + (i + 1) + ".xml");
			System.out.println((System.currentTimeMillis()-startTime)+"ms");
            */
			startTime = System.currentTimeMillis();
			System.out.print("--- -- generate annotation corpus " + (i + 1) + "... ");

			Cloner cloner = new Cloner();
			Corpus annotateCorpus = cloner.deepClone(splittedCorpora[i]);
			annotateCorpus.deleteAnnotation();
			System.out.println((System.currentTimeMillis() - startTime) + "ms");

			startTime = System.currentTimeMillis();
			System.out.print("--- -- train model " + (i + 1) + "... ");
			Model model = trainCorpus.trainModel();
			System.out.println((System.currentTimeMillis() - startTime) + "ms");

			startTime = System.currentTimeMillis();
			System.out.print("--- -- write model to file " + (i + 1) + "... ");
			model.writeModelToFile(foldFolder.getAbsolutePath() + File.separatorChar + "foldModel" + (i + 1) + ".txt");
			System.out.println((System.currentTimeMillis() - startTime) + "ms");

			startTime = System.currentTimeMillis();
			System.out.print("--- -- annotate corpus " + (i + 1) + "... ");
			annotateCorpus.annotateCorpus(model);
			System.out.println((System.currentTimeMillis() - startTime) + "ms");

			startTime = System.currentTimeMillis();
			System.out.print("--- -- validate annotated corpus " + (i + 1) + "... ");
			long[] valResult = validate(splittedCorpora[i], annotateCorpus);
			ValidateResult validateResult = new ValidateResult(valResult);
			result.addResult(validateResult);
			System.out.println((System.currentTimeMillis() - startTime) + "ms");

			startTime = System.currentTimeMillis();
			System.out.print("--- -- write annotated corpus to file " + (i + 1) + "... ");
			annotateCorpus.writeCorpusToFile(foldFolder.getAbsolutePath() + File.separatorChar + "foldCorpus" + (i + 1) + ".xml");
			System.out.println((System.currentTimeMillis() - startTime) + "ms");

			//System.out.println("--- -- Finished validating annotated corpus " + (i + 1) + " ---");

			System.out.println("--- -- Result for fold " + (i + 1) + " ---");

			validateResult.printResult();
			writeResultSingle(validateResult, foldFolder.getAbsolutePath() + File.separatorChar + "validateResult" + (i + 1) + ".txt");
			singleResults[i] = cloner.deepClone(validateResult);
			System.out.println("--- -- finished fold " + (i + 1) + " ---");
		}

		System.out.println();
		System.out.println("AVG F-Measure (correct IDref): \t" + result.getFMeasure(0));
		System.out.println("AVG F-Measure (FE identified in sentence): \t" + result.getFMeasure(1));
		System.out.println("AVG F-Measure (IDrefs FE-name independent): \t" + result.getFMeasure(2));

		writeResultGlobal(singleResults, result, currentCrossValidationFolder.getAbsolutePath() + File.separatorChar + "globalResult.txt");
		result.normalize(crossValidationCount);
		writeResultGlobal(singleResults, result, currentCrossValidationFolder.getAbsolutePath() + File.separatorChar + "globalResultNormalized.txt");

		System.out.println("--- Finished cross validation ---");

		return result;
	}