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

opennlp.tools.langdetect

## Class LanguageSample

- java.lang.Object
- - opennlp.tools.langdetect.LanguageSample

- All Implemented Interfaces:
    Serializable

      public class LanguageSample
      extends Object
      implements Serializable

  Class which holds a classified document and its @`Language`.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LanguageSample(Language language, CharSequence context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `CharSequence` | `getContext()`
    `Language` | `getLanguage()`
    `int` | `hashCode()`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### LanguageSample

          public LanguageSample(Language language,
                                CharSequence context)

  - ### Method Detail

    - #### getLanguage

          public Language getLanguage()

    - #### getContext

          public CharSequence getContext()

    - #### 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.