Package com.optimaize.langdetect
Class DetectedLanguage
- java.lang.Object
-
- com.optimaize.langdetect.DetectedLanguage
-
- All Implemented Interfaces:
java.lang.Comparable<DetectedLanguage>
public class DetectedLanguage extends java.lang.Object implements java.lang.Comparable<DetectedLanguage>
Holds information about a detected language: the locale (language) and the probability.Comparable: the "better" one comes before the worse. First order by probability descending (1 to 0). Then order by language ascending (a to z).
This class is immutable.
-
-
Field Summary
Fields Modifier and Type Field Description private @NotNull LdLocalelocaleprivate doubleprobability
-
Constructor Summary
Constructors Constructor Description DetectedLanguage(@NotNull LdLocale locale, double probability)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(DetectedLanguage o)See class header.@NotNull LdLocalegetLocale()doublegetProbability()java.lang.StringtoString()
-
-
-
Field Detail
-
locale
@NotNull private final @NotNull LdLocale locale
-
probability
private final double probability
-
-
Constructor Detail
-
DetectedLanguage
public DetectedLanguage(@NotNull @NotNull LdLocale locale, double probability)- Parameters:
locale-probability- 0-1
-
-
Method Detail
-
getLocale
@NotNull public @NotNull LdLocale getLocale()
-
getProbability
public double getProbability()
- Returns:
- 0-1, the higher the better.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(DetectedLanguage o)
See class header.- Specified by:
compareToin interfacejava.lang.Comparable<DetectedLanguage>
-
-