All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deeplearning4j.text.sentenceiterator.SynchronizedSentenceIterator Maven / Gradle / Ivy

There is a newer version: 1.0.0-M2.1
Show newest version
package org.deeplearning4j.text.sentenceiterator;

import lombok.NonNull;

/**
 * Simple synchronized wrapper for SentenceIterator interface implementations
 *
 * @author [email protected]
 */
public class SynchronizedSentenceIterator implements SentenceIterator {
    private SentenceIterator underlyingIterator;

    public SynchronizedSentenceIterator(@NonNull SentenceIterator iterator) {
        this.underlyingIterator = iterator;
    }

    @Override
    public synchronized String nextSentence() {
        return this.underlyingIterator.nextSentence();
    }

    @Override
    public synchronized boolean hasNext() {
        return underlyingIterator.hasNext();
    }

    @Override
    public synchronized void reset() {
        this.underlyingIterator.reset();
    }

    @Override
    public synchronized void finish() {
        this.underlyingIterator.finish();
    }

    @Override
    public synchronized SentencePreProcessor getPreProcessor() {
        return this.underlyingIterator.getPreProcessor();
    }

    @Override
    public synchronized void setPreProcessor(SentencePreProcessor preProcessor) {
        this.underlyingIterator.setPreProcessor(preProcessor);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy