opennlp.tools.sentdetect

## Class SentenceSample

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

- All Implemented Interfaces:
    Serializable

      public class SentenceSample
      extends Object
      implements Serializable

  A `SentenceSample` contains a document with begin indexes of the individual sentences.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SentenceSample(CharSequence document, Span... sentences)` Initializes the current instance.
    `SentenceSample(Detokenizer detokenizer, String[][] sentences)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `String` | `getDocument()` Retrieves the document.
    `Span[]` | `getSentences()` Retrieves the sentences.
    `int` | `hashCode()`
    `String` | `toString()`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SentenceSample

          public SentenceSample(CharSequence document,
                                Span... sentences)

      Initializes the current instance.
      Parameters:
        `document` -
        `sentences` -

    - #### SentenceSample

          public SentenceSample(Detokenizer detokenizer,
                                String[][] sentences)

  - ### Method Detail

    - #### getDocument

          public String getDocument()

      Retrieves the document.
      Returns:
        the document

    - #### getSentences

          public Span[] getSentences()

      Retrieves the sentences.
      Returns:
        the begin indexes of the sentences in the document.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

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