opennlp.tools.ml.model

## Class UniformPrior

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

- All Implemented Interfaces:
    Prior

      public class UniformPrior
      extends Object
      implements Prior

  Provide a maximum entropy model with a uniform prior.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UniformPrior()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `int` | `hashCode()`
    `void` | `logPrior(double[] dist, Context[] context, float[] values)` Populates the specified array with the the log of the distribution for the specified context.
    `void` | `logPrior(double[] dist, int[] context)` Populates the specified array with the the log of the distribution for the specified context.
    `void` | `logPrior(double[] dist, int[] context, float[] values)` Populates the specified array with the the log of the distribution for the specified context.
    `void` | `setLabels(String[] outcomeLabels, String[] contextLabels)` Method to specify the label for the outcomes and contexts.

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

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

- - ### Constructor Detail

    - #### UniformPrior

          public UniformPrior()

  - ### Method Detail

    - #### logPrior

          public void logPrior(double[] dist,
                               int[] context,
                               float[] values)

      Description copied from interface: `Prior`
      Populates the specified array with the the log of the distribution for the specified context. The returned array will be overwritten and needs to be re-initialized with every call to this method.
      Specified by:
        `logPrior` in interface `Prior`
      Parameters:
        `dist` - An array to be populated with the log of the prior distribution.
        `context` - The indices of the contextual predicates for an event.
        `values` - The values associated with the context.

    - #### logPrior

          public void logPrior(double[] dist,
                               Context[] context,
                               float[] values)

      Description copied from interface: `Prior`
      Populates the specified array with the the log of the distribution for the specified context. The returned array will be overwritten and needs to be re-initialized with every call to this method.
      Specified by:
        `logPrior` in interface `Prior`
      Parameters:
        `dist` - An array to be populated with the log of the prior distribution.
        `context` - The indices of the contextual predicates for an event.
        `values` - The values associated with the context.

    - #### logPrior

          public void logPrior(double[] dist,
                               int[] context)

      Description copied from interface: `Prior`
      Populates the specified array with the the log of the distribution for the specified context. The returned array will be overwritten and needs to be re-initialized with every call to this method.
      Specified by:
        `logPrior` in interface `Prior`
      Parameters:
        `dist` - An array to be populated with the log of the prior distribution.
        `context` - The indices of the contextual predicates for an event.

    - #### setLabels

          public void setLabels(String[] outcomeLabels,
                                String[] contextLabels)

      Description copied from interface: `Prior`
      Method to specify the label for the outcomes and contexts. This is used to map integer outcomes and contexts to their string values. This method is called prior to any call to #logPrior.
      Specified by:
        `setLabels` in interface `Prior`
      Parameters:
        `outcomeLabels` - An array of each outcome label.
        `contextLabels` - An array of each context label.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

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