home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (AggregatingSentenceIteratorTest.java)

This example Java source code file (AggregatingSentenceIteratorTest.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

aggregatingsentenceiteratortest, basiclineiterator, classpathresource, exception, file, string, test

The AggregatingSentenceIteratorTest.java Java example source code

package 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 {

    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()

        int cnt = 0;
        while (aggr.hasNext()) {
            String line = aggr.nextSentence();

        assertEquals((97162 * 2), cnt);


        while (aggr.hasNext()) {
            String line = aggr.nextSentence();

        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:

my book on functional programming


new blog posts


Copyright 1998-2019 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.