目录

class info
com.huawei.hms.mlsdk.text.MLTextAnalyzer.Factory
Creates a text analyzer instance to detect text. Only on-device detection is supported. On-cloud detection is not supported.

Public Constructor Summary

Constructor name

Factory(android.content.Context context)

Creates a text analyzer instance.

Public Method Summary

Return typeMethod name
MLTextAnalyzercreate()
MLTextAnalyzer.FactorysetLanguage(String language)
MLTextAnalyzer.FactorysetLocalOCRMode(int analyseType)

Public Constructors

Method
public Factory(android.content.Context context)
Creates a text analyzer instance.

Parameters

Parameter nameParameter desc
contextInput context.

Public Methods

Method
public MLTextAnalyzer create()
Creates a text analyzer instance.

Return

Typedesc
MLTextAnalyzerReturns the instance of the text analyzer MLTextAnalyzer.
Method
public MLTextAnalyzer.Factory setLanguage(String language)
Sets languages for the analyzer. The default setting is Romance languages.

Parameters

Parameter nameParameter desc
languageLanguage codes.
Supported languages:
en (English), zh (Chinese), ja (Japanese), ko (Korean),
ru (Russian), de (German), fr (French), it (Italian),
pt (Portuguese), and es (Spanish)


Return

Typedesc
MLTextAnalyzer.FactoryReturns the instance of MLTextAnalyzer.Factory.
Method
public MLTextAnalyzer.Factory setLocalOCRMode(int analyseType)
Sets the detection mode for the analyzer. The default value is OCR_DETECT_MODE (independent detection mode).

Parameters

Parameter nameParameter desc
analyseTypeDetection mode of the analyzer.
OCR_DETECT_MODE:
The value is 1, indicating the independent detection mode.
In this mode, each supplied image is detected independently.
This mode applies to single image detection.
OCR_TRACKING_MODE:
The value is 2, indicating the tracking mode.
In this mode, the detection result of the preceding frame is used
as the basis to quickly detect the text position in the image.
This mode applies to video stream text detection.


Return

Typedesc
MLTextAnalyzer.FactoryReturns the instance of MLTextAnalyzer.Factory.