Class POSSample

java.lang.Object
opennlp.tools.postag.POSSample
All Implemented Interfaces:
Serializable, Sample

public class POSSample extends Object implements Sample
Represents an pos-tagged sentence.
See Also:
  • Constructor Details

    • POSSample

      public POSSample(String[] sentence, String[] tags)
      Initializes a POSSample instance.
      Parameters:
      sentence - The sentence of tokens to be tagged.
      tags - An array of pos tags for each token provided in sentence.
    • POSSample

      public POSSample(List<String> sentence, List<String> tags)
      Initializes a POSSample instance.
      Parameters:
      sentence - The sentence to be tagged.
      tags - A List of pos tags for each token provided in sentence.
    • POSSample

      public POSSample(List<String> sentence, List<String> tags, String[][] additionalContext)
      Initializes a POSSample instance.
      Parameters:
      sentence - The sentence to be tagged.
      tags - A List of pos tags for each token provided in sentence.
      additionalContext - A 2D array which holds additional information for the context.
    • POSSample

      public POSSample(String[] sentence, String[] tags, String[][] additionalContext)
      Initializes a POSSample instance.
      Parameters:
      sentence - The sentence to be tagged.
      tags - An array of pos tags for each token provided in sentence.
      additionalContext - A 2D array which holds additional information for the context.
  • Method Details

    • getSentence

      public String[] getSentence()
      Returns:
      Retrieves the sentence as array.
    • getTags

      public String[] getTags()
      Returns:
      Retrieves the tags as array.
    • getAdditionalContext

      public String[][] getAdditionalContext()
      Returns:
      Retrieves additional information for the context.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • parse

      public static POSSample parse(String sentenceString) throws InvalidFormatException
      Parses a sentenceString.
      Parameters:
      sentenceString - The sentence to be parsed.
      Returns:
      A valid POSSample result.
      Throws:
      InvalidFormatException - Thrown if errors occurred during parsing.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object