@Test(timeout = 300000) public void hasNext() throws Exception { SentenceIterator iterator = new MutipleEpochsSentenceIterator( new BasicLineIterator(Resources.asFile("big/raw_sentences.txt")), 100); int cnt = 0; while (iterator.hasNext()) { iterator.nextSentence(); cnt++; } assertEquals(9716200, cnt); }
@Override public boolean hasNext() { if (!iterator.hasNext()) { if (counter.get() < numEpochs - 1) { counter.incrementAndGet(); iterator.reset(); return true; } else return false; } return true; }
MutipleEpochsSentenceIterator implements SentenceIterator { @Override public boolean hasNext() { if (!iterator.hasNext()) { if (counter.get() < numEpochs - 1) { counter.incrementAndGet(); iterator.reset(); return true; } else return false; } return true; } }
MutipleEpochsSentenceIterator implements SentenceIterator { @Override public boolean hasNext() { if (!iterator.hasNext()) { if (counter.get() < numEpochs - 1) { counter.incrementAndGet(); iterator.reset(); return true; } else return false; } return true; } MutipleEpochsSentenceIterator(@NonNull SentenceIterator iterator, int numEpochs); }
MutipleEpochsSentenceIterator implements SentenceIterator { @Override public boolean hasNext() { if (!iterator.hasNext()) { if (counter.get() < numEpochs - 1) { counter.incrementAndGet(); iterator.reset(); return true; } else return false; } return true; } MutipleEpochsSentenceIterator(@NonNull SentenceIterator iterator, int numEpochs); @Override String nextSentence(); @Override boolean hasNext(); @Override void reset(); @Override void finish(); @Override SentencePreProcessor getPreProcessor(); @Override void setPreProcessor(SentencePreProcessor preProcessor); }
MutipleEpochsSentenceIterator implements SentenceIterator { @Override public boolean hasNext() { if (!iterator.hasNext()) { if (counter.get() < numEpochs - 1) { counter.incrementAndGet(); iterator.reset(); return true; } else return false; } return true; } MutipleEpochsSentenceIterator(@NonNull SentenceIterator iterator, int numEpochs); @Override String nextSentence(); @Override boolean hasNext(); @Override void reset(); @Override void finish(); @Override SentencePreProcessor getPreProcessor(); @Override void setPreProcessor(SentencePreProcessor preProcessor);  }