Package opennlp.tools.ml.model

# Interface DataIndexer<P extends Parameters>

public interface DataIndexer<P extends Parameters>
Represents an indexer which compresses events in memory and performs feature selection.

See Also:
  - `ObjectStream`
  - `Parameters`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int[][]`
  `getContexts()`
  `int`
  `getNumEvents()`
  `int[]`
  `getNumTimesEventsSeen()`
  `String[]`
  `getOutcomeLabels()`
  `int[]`
  `getOutcomeList()`
  `int[]`
  `getPredCounts()`
  `String[]`
  `getPredLabels()`
  `float[][]`
  `getValues()`
  `void`
  `index(ObjectStream<Event> eventStream)`
  Performs the data indexing.
  `void`
  `init(P trainParams, Map<String,String> reportMap)`
  Sets parameters used during the data indexing.

- ## Method Details

  - ### getContexts

    int[][] getContexts()
    Returns:
      Retrieves a 2-dimensional array whose first dimension is the event index and array this refers to contains the contexts for that event.

  - ### getNumTimesEventsSeen

    int[] getNumTimesEventsSeen()
    Returns:
      Retrieves an array indexed by the event index indicating the number of times a particular event was seen.

  - ### getOutcomeList

    int[] getOutcomeList()
    Returns:
      Retrieves an array indicating the outcome index for each event.

  - ### getPredLabels

    String[] getPredLabels()
    Returns:
      Retrieves an array of predicate/context names indexed by context index. These indices are the value of the array returned by `getContexts()`.

  - ### getPredCounts

    int[] getPredCounts()
    Returns:
      Retrieves an array of the count of each predicate in the events.

  - ### getOutcomeLabels

    String[] getOutcomeLabels()
    Returns:
      Retrieves an array of outcome names indexed by outcome index.

  - ### getValues

    float[][] getValues()
    Returns:
      Retrieves the values associated with each event context or `null` if integer values are to be used.

  - ### getNumEvents

    int getNumEvents()
    Returns:
      Retrieves the number of total events indexed.

  - ### init

    void init(P trainParams, Map<String,String> reportMap)
    Sets parameters used during the data indexing.
    Parameters:
      `trainParams` - The `Parameters` to be used.
      `reportMap` - The `Map` used for reporting.

  - ### index

    void index(ObjectStream<Event> eventStream) throws IOException
    Performs the data indexing.

    Note: Make sure the `init(Parameters, Map)` method is called first.

    Parameters:
      `eventStream` - A `ObjectStream<Event>` of events used as input.
    Throws:
      `IOException` - Thrown if IO errors occurred during indexing.