Record Class ReductionSettings

java.lang.Object
java.lang.Record
org.egothor.stemmer.ReductionSettings
Record Components:
reductionMode - reduction mode
dominantWinnerMinPercent - minimum dominant winner percentage
dominantWinnerOverSecondRatio - minimum winner-over-second ratio

public record ReductionSettings(ReductionMode reductionMode, int dominantWinnerMinPercent, int dominantWinnerOverSecondRatio) extends Record
Immutable reduction configuration used by FrequencyTrie.Builder.

The settings influence how mutable trie nodes are merged into canonical read-only nodes during compilation.

  • Field Details

    • DEFAULT_DOMINANT_WINNER_MIN_PERCENT

      public static final int DEFAULT_DOMINANT_WINNER_MIN_PERCENT
      Default minimum dominant winner percentage.
      See Also:
    • DEFAULT_DOMINANT_WINNER_OVER_SECOND_RATIO

      public static final int DEFAULT_DOMINANT_WINNER_OVER_SECOND_RATIO
      Default minimum winner-over-second ratio.
      See Also:
  • Constructor Details

    • ReductionSettings

      public ReductionSettings(ReductionMode reductionMode, int dominantWinnerMinPercent, int dominantWinnerOverSecondRatio)
      Creates a new instance.
      Parameters:
      reductionMode - reduction mode
      dominantWinnerMinPercent - minimum dominant winner percentage in the inclusive range 1..100
      dominantWinnerOverSecondRatio - minimum winner-over-second ratio, must be at least 1
      Throws:
      NullPointerException - if reductionMode is null
      IllegalArgumentException - if any numeric value is outside the valid range
  • Method Details

    • withDefaults

      public static ReductionSettings withDefaults(ReductionMode reductionMode)
      Creates settings with default dominance thresholds.
      Parameters:
      reductionMode - reduction mode
      Returns:
      new settings instance
      Throws:
      NullPointerException - if reductionMode is null
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • reductionMode

      public ReductionMode reductionMode()
      Returns the value of the reductionMode record component.
      Returns:
      the value of the reductionMode record component
    • dominantWinnerMinPercent

      public int dominantWinnerMinPercent()
      Returns the value of the dominantWinnerMinPercent record component.
      Returns:
      the value of the dominantWinnerMinPercent record component
    • dominantWinnerOverSecondRatio

      public int dominantWinnerOverSecondRatio()
      Returns the value of the dominantWinnerOverSecondRatio record component.
      Returns:
      the value of the dominantWinnerOverSecondRatio record component