Builder for LanguageDetector.LanguageDetectorOptions
.
Public Constructors
Builder()
|
Public Methods
final LanguageDetector.LanguageDetectorOptions |
build()
Validates and builds the
LanguageDetector.LanguageDetectorOptions instance. |
abstract LanguageDetector.LanguageDetectorOptions.Builder | |
abstract LanguageDetector.LanguageDetectorOptions.Builder | |
abstract LanguageDetector.LanguageDetectorOptions.Builder | |
abstract LanguageDetector.LanguageDetectorOptions.Builder |
setDisplayNamesLocale(String locale)
Sets the optional locale to use for display names specified through the TFLite Model
Metadata, if any.
|
abstract LanguageDetector.LanguageDetectorOptions.Builder |
setMaxResults(Integer maxResults)
Sets the optional maximum number of top-scored classification results to return.
|
abstract LanguageDetector.LanguageDetectorOptions.Builder |
Inherited Methods
Public Constructors
public Builder ()
Public Methods
public final LanguageDetector.LanguageDetectorOptions build ()
Validates and builds the LanguageDetector.LanguageDetectorOptions
instance.
Throws
IllegalArgumentException | if any of the set options are invalid. |
---|
public abstract LanguageDetector.LanguageDetectorOptions.Builder setBaseOptions (BaseOptions value)
Sets the base options for the text classifier task.
Parameters
value |
---|
public abstract LanguageDetector.LanguageDetectorOptions.Builder setCategoryAllowlist (List<String> categoryAllowlist)
Sets the optional allowlist of category names.
If non-empty, detection results whose category name is not in this set will be filtered
out. Duplicate or unknown category names are ignored. Mutually exclusive with categoryDenylist
.
Parameters
categoryAllowlist |
---|
public abstract LanguageDetector.LanguageDetectorOptions.Builder setCategoryDenylist (List<String> categoryDenylist)
Sets the optional denylist of category names.
If non-empty, detection results whose category name is in this set will be filtered out.
Duplicate or unknown category names are ignored. Mutually exclusive with categoryAllowlist
.
Parameters
categoryDenylist |
---|
public abstract LanguageDetector.LanguageDetectorOptions.Builder setDisplayNamesLocale (String locale)
Sets the optional locale to use for display names specified through the TFLite Model Metadata, if any.
Parameters
locale |
---|
public abstract LanguageDetector.LanguageDetectorOptions.Builder setMaxResults (Integer maxResults)
Sets the optional maximum number of top-scored classification results to return.
If not set, all available results are returned. If set, must be > 0.
Parameters
maxResults |
---|
public abstract LanguageDetector.LanguageDetectorOptions.Builder setScoreThreshold (Float scoreThreshold)
Sets the optional score threshold. Results with score below this value are rejected.
Overrides the score threshold specified in the TFLite Model Metadata, if any.
Parameters
scoreThreshold |
---|