Package opennlp.tools.doccat

## 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:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DocumentSample​(String category, String[] text)` | Initializes a `instance`.
    `DocumentSample​(String category, String[] text, Map<String,​Object> extraInformation)` | Initializes a `instance`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object obj)` |
    `String` | `getCategory()` |
    `Map<String,​Object>` | `getExtraInformation()` |
    `String[]` | `getText()` |
    `int` | `hashCode()` |
    `String` | `toString()` |

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

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

- - ### Constructor Detail

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

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