class OpenNlpSentenceDetector implements SentenceDetector {

    @Override
    public Iterator<Token> iterateTokens(final String text) {
        final opennlp.tools.util.Span[] spans = model.sentPosDetect(text);
        return new AbstractIterator<Token>() {
            int idx = 0;

            @Override
            protected Token getNext() throws Finished {
                if (idx >= spans.length) {
                    throw FINISHED;
                }
                opennlp.tools.util.Span span = spans[idx++];
                String value = text.substring(span.getStart(), span.getEnd());
                return new ImmutableToken(span.getStart(), value);
            }
        };
    }

    public  OpenNlpSentenceDetector(File modelFile);

}