NewlineSentenceDetector (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.sentdetect

## Class NewlineSentenceDetector

- java.lang.Object
- - opennlp.tools.sentdetect.NewlineSentenceDetector

- All Implemented Interfaces:
    SentenceDetector

      public class NewlineSentenceDetector
      extends Object
      implements SentenceDetector

  The Newline Sentence Detector assumes that sentences are line delimited and recognizes one sentence per non-empty line.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NewlineSentenceDetector()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `sentDetect(String s)` Sentence detect a string.
    `Span[]` | `sentPosDetect(String s)` Sentence detect a string.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NewlineSentenceDetector

          public NewlineSentenceDetector()

  - ### Method Detail

    - #### sentDetect

          public String[] sentDetect(String s)

      Description copied from interface: `SentenceDetector`
      Sentence detect a string.
      Specified by:
        `sentDetect` in interface `SentenceDetector`
      Parameters:
        `s` - The string to be sentence detected.
      Returns:
        The String[] with the individual sentences as the array elements.

    - #### sentPosDetect

          public Span[] sentPosDetect(String s)

      Description copied from interface: `SentenceDetector`
      Sentence detect a string.
      Specified by:
        `sentPosDetect` in interface `SentenceDetector`
      Parameters:
        `s` - The string to be sentence detected.
      Returns:
        The Span[] with the spans (offsets into s) for each detected sentence as the individuals array elements.

Copyright © 2026 The Apache Software Foundation. All rights reserved.