public static File createMinimalSplit(String inputFolder,int numFolds,int numAvailableJCas,boolean isSequence) throws Exception {
  File outputFolder=new File(inputFolder,"output");
  int splitNum=(int)Math.ceil(numFolds / (double)numAvailableJCas);
  CollectionReaderDescription createReader=CollectionReaderFactory.createReaderDescription(BinaryCasReader.class,BinaryCasReader.PARAM_SOURCE_LOCATION,inputFolder,BinaryCasReader.PARAM_PATTERNS,"*.bin");
  AnalysisEngineDescription multiplier=AnalysisEngineFactory.createEngineDescription(FoldClassificationUnitCasMultiplier.class,FoldClassificationUnitCasMultiplier.PARAM_REQUESTED_SPLITS,splitNum,FoldClassificationUnitCasMultiplier.PARAM_USE_SEQUENCES,isSequence);
  AnalysisEngineDescription xmiWriter=AnalysisEngineFactory.createEngineDescription(BinaryCasWriter.class,BinaryCasWriter.PARAM_TARGET_LOCATION,outputFolder.getAbsolutePath(),BinaryCasWriter.PARAM_FORMAT,"6+");
  AnalysisEngineDescription both=AnalysisEngineFactory.createEngineDescription(multiplier,xmiWriter);
  SimplePipeline.runPipeline(createReader,both);
  isNumberOfCasCreatedLargerEqualNumFolds(outputFolder,numFolds);
  return outputFolder;
}

public static File createMinimalSplit ( String inputFolder , int numFolds , int numAvailableJCas , boolean isSequence ) throws Exception { File outputFolder = new File ( inputFolder , "output" ) ; int splitNum = ( int ) Math . ceil ( numFolds / ( double ) numAvailableJCas ) ; CollectionReaderDescription createReader = CollectionReaderFactory . createReaderDescription ( BinaryCasReader . class , BinaryCasReader . PARAM_SOURCE_LOCATION , inputFolder , BinaryCasReader . PARAM_PATTERNS , "*.bin" ) ; AnalysisEngineDescription multiplier = AnalysisEngineFactory . createEngineDescription ( FoldClassificationUnitCasMultiplier . class , FoldClassificationUnitCasMultiplier . PARAM_REQUESTED_SPLITS , splitNum , FoldClassificationUnitCasMultiplier . PARAM_USE_SEQUENCES , isSequence ) ; AnalysisEngineDescription xmiWriter = AnalysisEngineFactory . createEngineDescription ( BinaryCasWriter . class , BinaryCasWriter . PARAM_TARGET_LOCATION , outputFolder . getAbsolutePath ( ) , BinaryCasWriter . PARAM_FORMAT , "6+" ) ; AnalysisEngineDescription both = AnalysisEngineFactory . createEngineDescription ( multiplier , xmiWriter ) ; SimplePipeline . runPipeline ( createReader , both ) ; isNumberOfCasCreatedLargerEqualNumFolds ( outputFolder , numFolds ) ; return outputFolder ; }
takes the available cas and creates more cases from them to conform to the minimal requested amount of cas objects to have sufficient for running a cross - validation . computes a rule - of - thumb value to split each of the found cas into n sub - cases and the end the total created number is compared to the requested number of cas and an exception thrown if too few cas were created .
