Class DocumentSample

java.lang.Object
opennlp.tools.doccat.DocumentSample
All Implemented Interfaces:
Serializable, Sample

public class DocumentSample extends Object implements Sample
Class which holds a classified document and its category.
See Also:
  • Constructor Details

    • DocumentSample

      public DocumentSample(String category, String[] text)
      Initializes a instance.
      Parameters:
      category - The category to be used. Must not be null.
      text - The plain text in a tokenized form. Must not be null.
    • DocumentSample

      public DocumentSample(String category, String[] text, Map<String,Object> extraInformation)
      Initializes a instance.
      Parameters:
      category - The category to be used.Must not be null.
      text - The plain text in a tokenized form. Must not be null.
      extraInformation - Additional information for context.
  • Method Details

    • getCategory

      public String getCategory()
      Returns:
      Retrieves the category.
    • getText

      public String[] getText()
      Returns:
      Retrieves the text in a tokenized form.
    • getExtraInformation

      public Map<String,Object> getExtraInformation()
      Returns:
      Retrieves contextual extra information.
    • 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