@Test(expected = InvalidFormatException.class) public void testNotEnoughSentences() throws IOException { int samplesPerLanguage = 2; int sentencesPerSample = 2; LeipzigLanguageSampleStream stream = new LeipzigLanguageSampleStream(new File(testDataPath), sentencesPerSample, samplesPerLanguage); while (stream.read() != null); }
public LanguageSample read() throws IOException { LanguageSample sample; if (sampleStream != null && (sample = sampleStream.read()) != null) { return sample; } else { if (sentencesFilesIt.hasNext()) { File sentencesFile = sentencesFilesIt.next(); String lang = sentencesFile.getName().substring(0, 3); sampleStream = new LeipzigSentencesStream(lang, sentencesFile, sentencesPerSample, langSampleCounts.get(lang)); return read(); } } return null; }
LeipzigLanguageSampleStream implements ObjectStream<LanguageSample> { public LanguageSample read() throws IOException { LanguageSample sample; if (sampleStream != null && (sample = sampleStream.read()) != null) { return sample; } else { if (sentencesFilesIt.hasNext()) { File sentencesFile = sentencesFilesIt.next(); String lang = sentencesFile.getName().substring(0, 3); sampleStream = new LeipzigSentencesStream(lang, sentencesFile, sentencesPerSample, langSampleCounts.get(lang)); return read(); } } return null; } }
LeipzigLanguageSampleStream implements ObjectStream<LanguageSample> { public LanguageSample read() throws IOException { LanguageSample sample; if (sampleStream != null && (sample = sampleStream.read()) != null) { return sample; } else { if (sentencesFilesIt.hasNext()) { File sentencesFile = sentencesFilesIt.next(); String lang = sentencesFile.getName().substring(0, 3); sampleStream = new LeipzigSentencesStream(lang, sentencesFile, sentencesPerSample, langSampleCounts.get(lang)); return read(); } } return null; } LeipzigLanguageSampleStream(File leipzigFolder, final int sentencesPerSample,
                                     final int samplesPerLanguage); }
LeipzigLanguageSampleStream implements ObjectStream<LanguageSample> { public LanguageSample read() throws IOException { LanguageSample sample; if (sampleStream != null && (sample = sampleStream.read()) != null) { return sample; } else { if (sentencesFilesIt.hasNext()) { File sentencesFile = sentencesFilesIt.next(); String lang = sentencesFile.getName().substring(0, 3); sampleStream = new LeipzigSentencesStream(lang, sentencesFile, sentencesPerSample, langSampleCounts.get(lang)); return read(); } } return null; } LeipzigLanguageSampleStream(File leipzigFolder, final int sentencesPerSample,
                                     final int samplesPerLanguage); LanguageSample read(); @Override void reset(); }
LeipzigLanguageSampleStream implements ObjectStream<LanguageSample> { public LanguageSample read() throws IOException { LanguageSample sample; if (sampleStream != null && (sample = sampleStream.read()) != null) { return sample; } else { if (sentencesFilesIt.hasNext()) { File sentencesFile = sentencesFilesIt.next(); String lang = sentencesFile.getName().substring(0, 3); sampleStream = new LeipzigSentencesStream(lang, sentencesFile, sentencesPerSample, langSampleCounts.get(lang)); return read(); } } return null; } LeipzigLanguageSampleStream(File leipzigFolder, final int sentencesPerSample,
                                     final int samplesPerLanguage); LanguageSample read(); @Override void reset();  }