Package org.egothor.stemmer
Record Class ReductionSettings
java.lang.Object
java.lang.Record
org.egothor.stemmer.ReductionSettings
- Record Components:
reductionMode- reduction modedominantWinnerMinPercent- minimum dominant winner percentagedominantWinnerOverSecondRatio- 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault minimum dominant winner percentage.static final intDefault minimum winner-over-second ratio. -
Constructor Summary
ConstructorsConstructorDescriptionReductionSettings(ReductionMode reductionMode, int dominantWinnerMinPercent, int dominantWinnerOverSecondRatio) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thedominantWinnerMinPercentrecord component.intReturns the value of thedominantWinnerOverSecondRatiorecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thereductionModerecord component.final StringtoString()Returns a string representation of this record class.static ReductionSettingswithDefaults(ReductionMode reductionMode) Creates settings with default dominance thresholds.
-
Field Details
-
DEFAULT_DOMINANT_WINNER_MIN_PERCENT
public static final int DEFAULT_DOMINANT_WINNER_MIN_PERCENTDefault minimum dominant winner percentage.- See Also:
-
DEFAULT_DOMINANT_WINNER_OVER_SECOND_RATIO
public static final int DEFAULT_DOMINANT_WINNER_OVER_SECOND_RATIODefault 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 modedominantWinnerMinPercent- minimum dominant winner percentage in the inclusive range1..100dominantWinnerOverSecondRatio- minimum winner-over-second ratio, must be at least1- Throws:
NullPointerException- ifreductionModeisnullIllegalArgumentException- if any numeric value is outside the valid range
-
-
Method Details
-
withDefaults
Creates settings with default dominance thresholds.- Parameters:
reductionMode- reduction mode- Returns:
- new settings instance
- Throws:
NullPointerException- ifreductionModeisnull
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
reductionMode
Returns the value of thereductionModerecord component.- Returns:
- the value of the
reductionModerecord component
-
dominantWinnerMinPercent
public int dominantWinnerMinPercent()Returns the value of thedominantWinnerMinPercentrecord component.- Returns:
- the value of the
dominantWinnerMinPercentrecord component
-
dominantWinnerOverSecondRatio
public int dominantWinnerOverSecondRatio()Returns the value of thedominantWinnerOverSecondRatiorecord component.- Returns:
- the value of the
dominantWinnerOverSecondRatiorecord component
-