class DocumentBySentenceSplitter extends HierarchicalDocumentSplitter {

    private final SentenceModel sentenceModel;

    public DocumentBySentenceSplitter(int maxSegmentSizeInChars,
                                      int maxOverlapSizeInChars) {
        super(maxSegmentSizeInChars, maxOverlapSizeInChars, null, null);
        this.sentenceModel = createSentenceModel();
    }

    public DocumentBySentenceSplitter(int maxSegmentSizeInChars,
                                      int maxOverlapSizeInChars,
                                      DocumentSplitter subSplitter) {
        super(maxSegmentSizeInChars, maxOverlapSizeInChars, null, subSplitter);
        this.sentenceModel = createSentenceModel();
    }

    public DocumentBySentenceSplitter(int maxSegmentSizeInTokens,
                                      int maxOverlapSizeInTokens,
                                      Tokenizer tokenizer) {
        super(maxSegmentSizeInTokens, maxOverlapSizeInTokens, tokenizer, null);
        this.sentenceModel = createSentenceModel();
    }

    public DocumentBySentenceSplitter(int maxSegmentSizeInTokens,
                                      int maxOverlapSizeInTokens,
                                      Tokenizer tokenizer,
                                      DocumentSplitter subSplitter) {
        super(maxSegmentSizeInTokens, maxOverlapSizeInTokens, tokenizer, subSplitter);
        this.sentenceModel = createSentenceModel();
    }

    private SentenceModel createSentenceModel() {<FILL_FUNCTION_BODY>}

    @Override
    public String[] split(String text) {
        SentenceDetectorME sentenceDetector = new SentenceDetectorME(sentenceModel);
        return sentenceDetector.sentDetect(text);
    }

    @Override
    public String joinDelimiter() {
        return " ";
    }

    @Override
    protected DocumentSplitter defaultSubSplitter() {
        return new DocumentByWordSplitter(maxSegmentSize, maxOverlapSize, tokenizer);
    }
}

        String sentenceModelFilePath = "/opennlp/opennlp-en-ud-ewt-sentence-1.0-1.9.3.bin";
        try (InputStream is = getClass().getResourceAsStream(sentenceModelFilePath)) {
            return new SentenceModel(is);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    
<methods>public List<dev.langchain4j.data.segment.TextSegment> split(dev.langchain4j.data.document.Document) <variables>private static final java.lang.String INDEX,protected final non-sealed int maxOverlapSize,protected final non-sealed int maxSegmentSize,private final dev.langchain4j.data.document.splitter.HierarchicalDocumentSplitter overlapSentenceSplitter,protected final non-sealed dev.langchain4j.data.document.DocumentSplitter subSplitter,protected final non-sealed dev.langchain4j.model.Tokenizer tokenizer