目录

class info
com.huawei.hms.mlsdk.langdetect.local.MLLocalLangDetector
Local offline language detector.

Constant Summary

TypeNameDesc
floatFIRST_BEST_DETECTION_LANGUAGE_TRUSTED_THRESHOLDConfidence threshold in the scenario where the language detection result with the highest confidence is returned.
floatPROBABILITY_DETECTION_LANGUAGE_TRUSTED_THRESHOLDConfidence threshold in the scenario where detection results of multiple languages are returned.
StringUNDETECTION_LANGUAGE_TRUSTED_THRESHOLDUndetected language code.

Public Method Summary

Return typeMethod name
MLLocalLangDetectorcreate(MLApplication app, MLLocalLangDetectorSetting setting)
com.huawei.hmf.tasks.TaskfirstBestDetect(String text)
com.huawei.hmf.tasks.Task<listprobabilityDetect(String text)
voidstop()

Constants

Constant
public static final float FIRST_BEST_DETECTION_LANGUAGE_TRUSTED_THRESHOLD

Confidence threshold in the scenario where the language detection result with the highest confidence is returned.

Constant Value:0.5f

Constant
public static final float PROBABILITY_DETECTION_LANGUAGE_TRUSTED_THRESHOLD

Confidence threshold in the scenario where detection results of multiple languages are returned.

Constant Value:0.009999999776482582f

Constant
public static final String UNDETECTION_LANGUAGE_TRUSTED_THRESHOLD

Undetected language code.

Constant Value:”unknown”

Public Methods

Method
public static synchronized MLLocalLangDetector create(MLApplication app, MLLocalLangDetectorSetting setting)
Creates a local offline language detector object.

Parameters

Parameter nameParameter desc
appSpecified app.
settingLocal offline language detector configurator instance.

Return

Typedesc
MLLocalLangDetectorLocal offline language detector object.
Method
public com.huawei.hmf.tasks.Task<String> firstBestDetect(String text)
Returns the language detection result with the highest confidence based on the supplied text.

Parameters

Parameter nameParameter desc
textText.


Return

Typedesc
com.huawei.hmf.tasks.Task<String>Task object containing the language detection results.
Method

public com.huawei.hmf.tasks.Task<List<com.huawei.hms.mlsdk.langdetect.MLDetectedLang>> probabilityDetect(String text)

Returns multi-language detection results based on the supplied text.

Parameters

Parameter nameParameter desc
textText.


Return

Typedesc
com.huawei.hmf.tasks.Task<List<com.huawei.hms.mlsdk.langdetect.MLDetectedLang>>Task object containing the multi-language detection results.
Method
public void stop()
Releases resources, including input and output streams.