opennlp.tools.ml.model

## Class AbstractDataIndexer

- java.lang.Object
- - opennlp.tools.ml.model.AbstractDataIndexer

- All Implemented Interfaces:
    DataIndexer
  Direct Known Subclasses:
    OnePassDataIndexer, TwoPassDataIndexer

      public abstract class AbstractDataIndexer
      extends Object
      implements DataIndexer

  Abstract class for collecting event and context counts used in training.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CUTOFF_DEFAULT`
    `static String` | `CUTOFF_PARAM`
    `static boolean` | `SORT_DEFAULT`
    `static String` | `SORT_PARAM`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractDataIndexer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[][]` | `getContexts()` Returns the array of predicates seen in each event.
    `int` | `getNumEvents()` Returns the number of total events indexed.
    `int[]` | `getNumTimesEventsSeen()` Returns an array indicating the number of times a particular event was seen.
    `String[]` | `getOutcomeLabels()` Returns an array of outcome names.
    `int[]` | `getOutcomeList()` Returns an array indicating the outcome index for each event.
    `int[]` | `getPredCounts()` Returns an array of the count of each predicate in the events.
    `String[]` | `getPredLabels()` Returns an array of predicate/context names.
    `float[][]` | `getValues()` Returns the values associated with each event context or null if integer values are to be used.
    `void` | `init(TrainingParameters indexingParameters, Map<String,String> reportMap)` Sets parameters used during the data indexing.

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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface opennlp.tools.ml.model.DataIndexer

      `index`

- - ### Field Detail

    - #### CUTOFF_PARAM

          public static final String CUTOFF_PARAM

      See Also:
        Constant Field Values

    - #### CUTOFF_DEFAULT

          public static final int CUTOFF_DEFAULT

      See Also:
        Constant Field Values

    - #### SORT_PARAM

          public static final String SORT_PARAM

      See Also:
        Constant Field Values

    - #### SORT_DEFAULT

          public static final boolean SORT_DEFAULT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractDataIndexer

          public AbstractDataIndexer()

  - ### Method Detail

    - #### init

          public void init(TrainingParameters indexingParameters,
                           Map<String,String> reportMap)

      Description copied from interface: `DataIndexer`
      Sets parameters used during the data indexing.
      Specified by:
        `init` in interface `DataIndexer`
      Parameters:
        `indexingParameters` - `TrainingParameters`

    - #### getContexts

          public int[][] getContexts()

      Description copied from interface: `DataIndexer`
      Returns the array of predicates seen in each event.
      Specified by:
        `getContexts` in interface `DataIndexer`
      Returns:
        a 2-D array whose first dimension is the event index and array this refers to contains the contexts for that event.

    - #### getNumTimesEventsSeen

          public int[] getNumTimesEventsSeen()

      Description copied from interface: `DataIndexer`
      Returns an array indicating the number of times a particular event was seen.
      Specified by:
        `getNumTimesEventsSeen` in interface `DataIndexer`
      Returns:
        an array indexed by the event index indicating the number of times a particular event was seen.

    - #### getOutcomeList

          public int[] getOutcomeList()

      Description copied from interface: `DataIndexer`
      Returns an array indicating the outcome index for each event.
      Specified by:
        `getOutcomeList` in interface `DataIndexer`
      Returns:
        an array indicating the outcome index for each event.

    - #### getPredLabels

          public String[] getPredLabels()

      Description copied from interface: `DataIndexer`
      Returns an array of predicate/context names.
      Specified by:
        `getPredLabels` in interface `DataIndexer`
      Returns:
        an array of predicate/context names indexed by context index. These indices are the value of the array returned by `getContexts`.

    - #### getOutcomeLabels

          public String[] getOutcomeLabels()

      Description copied from interface: `DataIndexer`
      Returns an array of outcome names.
      Specified by:
        `getOutcomeLabels` in interface `DataIndexer`
      Returns:
        an array of outcome names indexed by outcome index.

    - #### getPredCounts

          public int[] getPredCounts()

      Description copied from interface: `DataIndexer`
      Returns an array of the count of each predicate in the events.
      Specified by:
        `getPredCounts` in interface `DataIndexer`
      Returns:
        an array of the count of each predicate in the events.

    - #### getNumEvents

          public int getNumEvents()

      Description copied from interface: `DataIndexer`
      Returns the number of total events indexed.
      Specified by:
        `getNumEvents` in interface `DataIndexer`
      Returns:
        The number of total events indexed.

    - #### getValues

          public float[][] getValues()

      Description copied from interface: `DataIndexer`
      Returns the values associated with each event context or null if integer values are to be used.
      Specified by:
        `getValues` in interface `DataIndexer`
      Returns:
        the values associated with each event context.

Copyright © 2026 The Apache Software Foundation. All rights reserved.