|
Java example source code file (AggregatingSentenceIteratorTest.java)
The AggregatingSentenceIteratorTest.java Java example source codepackage org.deeplearning4j.text.sentenceiterator; import org.canova.api.util.ClassPathResource; import org.junit.Test; import java.io.File; import static org.junit.Assert.*; /** * Created by fartovii on 01.12.15. */ public class AggregatingSentenceIteratorTest { @Test public void testHasNext() throws Exception { ClassPathResource resource = new ClassPathResource("/big/raw_sentences.txt"); File file = resource.getFile(); BasicLineIterator iterator = new BasicLineIterator(file); BasicLineIterator iterator2 = new BasicLineIterator(file); AggregatingSentenceIterator aggr = new AggregatingSentenceIterator.Builder() .addSentenceIterator(iterator) .addSentenceIterator(iterator2) .build(); int cnt = 0; while (aggr.hasNext()) { String line = aggr.nextSentence(); cnt++; } assertEquals((97162 * 2), cnt); aggr.reset(); while (aggr.hasNext()) { String line = aggr.nextSentence(); cnt++; } assertEquals((97162 * 4), cnt); } } Other Java examples (source code examples)Here is a short list of links related to this Java AggregatingSentenceIteratorTest.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.