opennlp.tools.postag

## Class POSSample

- java.lang.Object
- - opennlp.tools.postag.POSSample

- All Implemented Interfaces:
    Serializable

      public class POSSample
      extends Object
      implements Serializable

  Represents an pos-tagged sentence.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `POSSample(List<String> sentence, List<String> tags)`
    `POSSample(List<String> sentence, List<String> tags, String[][] additionalContext)`
    `POSSample(String[] sentence, String[] tags)`
    `POSSample(String[] sentence, String[] tags, String[][] additionalContext)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `String[][]` | `getAddictionalContext()`
    `String[]` | `getSentence()`
    `String[]` | `getTags()`
    `int` | `hashCode()`
    `static POSSample` | `parse(String sentenceString)`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### POSSample

          public POSSample(String[] sentence,
                           String[] tags)

    - #### POSSample

          public POSSample(List<String> sentence,
                           List<String> tags)

    - #### POSSample

          public POSSample(List<String> sentence,
                           List<String> tags,
                           String[][] additionalContext)

    - #### POSSample

          public POSSample(String[] sentence,
                           String[] tags,
                           String[][] additionalContext)

  - ### Method Detail

    - #### getSentence

          public String[] getSentence()

    - #### getTags

          public String[] getTags()

    - #### getAddictionalContext

          public String[][] getAddictionalContext()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### parse

          public static POSSample parse(String sentenceString)
                                 throws InvalidFormatException

      Throws:
        `InvalidFormatException`

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