@Test public void testNoSeqSplittingOneTcuIntoOneCas() throws Exception { File output = FoldUtil.createMinimalSplit(tmpFoldNoSeq.getRoot().getAbsolutePath(), 13, 1, false); List<File> writtenBins = getWrittenBins(output); List<Integer> numTcusCas = countNumberOfTextClassificationUnitsPerCas(writtenBins); assertEquals(13, writtenBins.size()); assertEquals(new Integer(1), numTcusCas.get(0)); assertEquals(new Integer(1), numTcusCas.get(1)); assertEquals(new Integer(1), numTcusCas.get(2)); assertEquals(new Integer(1), numTcusCas.get(3)); assertEquals(new Integer(1), numTcusCas.get(4)); assertEquals(new Integer(1), numTcusCas.get(5)); assertEquals(new Integer(1), numTcusCas.get(6)); assertEquals(new Integer(1), numTcusCas.get(7)); assertEquals(new Integer(1), numTcusCas.get(8)); assertEquals(new Integer(1), numTcusCas.get(9)); assertEquals(new Integer(1), numTcusCas.get(10)); assertEquals(new Integer(1), numTcusCas.get(11)); assertEquals(new Integer(1), numTcusCas.get(12)); }
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", BinaryCasReader.PARAM_ADD_DOCUMENT_METADATA, false); 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; }
FoldUtil { 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", BinaryCasReader.PARAM_ADD_DOCUMENT_METADATA, false); 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; } }
FoldUtil { 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", BinaryCasReader.PARAM_ADD_DOCUMENT_METADATA, false); 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; }  }
FoldUtil { 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", BinaryCasReader.PARAM_ADD_DOCUMENT_METADATA, false); 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; }  static File createMinimalSplit(String inputFolder, int numFolds, int numAvailableJCas,
            boolean isSequence); }
FoldUtil { 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", BinaryCasReader.PARAM_ADD_DOCUMENT_METADATA, false); 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; }  static File createMinimalSplit(String inputFolder, int numFolds, int numAvailableJCas,
            boolean isSequence);  }