ComparablePredicate (Apache OpenNLP Tools 1.9.5 API)
Date: 2026-06-18

opennlp.tools.ml.model

## Class ComparablePredicate

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

- All Implemented Interfaces:
    Comparable<ComparablePredicate>

      public class ComparablePredicate
      extends Object
      implements Comparable<ComparablePredicate>

  A maxent predicate representation which we can use to sort based on the outcomes. This allows us to make the mapping of features to their parameters much more compact.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `String` | `name`
    `int[]` | `outcomes`
    `double[]` | `params`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ComparablePredicate(String n, int[] ocs, double[] ps)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(ComparablePredicate cp)`
    `boolean` | `equals(Object obj)`
    `int` | `hashCode()`
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### name

          public String name

    - #### outcomes

          public int[] outcomes

    - #### params

          public double[] params

  - ### Constructor Detail

    - #### ComparablePredicate

          public ComparablePredicate(String n,
                                     int[] ocs,
                                     double[] ps)

  - ### Method Detail

    - #### compareTo

          public int compareTo(ComparablePredicate cp)

      Specified by:
        `compareTo` in interface `Comparable<ComparablePredicate>`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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