Class DetectionApiImpl
- java.lang.Object
-
- com.github.vbauer.yta.service.basic.AbstractApi
-
- com.github.vbauer.yta.service.fraction.impl.DetectionApiImpl
-
- All Implemented Interfaces:
DetectionApi
@ThreadSafe public class DetectionApiImpl extends AbstractApi implements DetectionApi
SeeDetectionApi
.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ATTR_FORMAT
static java.lang.String
ATTR_TEXT
static java.lang.String
METHOD_DETECT
-
Constructor Summary
Constructors Constructor Description DetectionApiImpl(ApiContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<Language>
detect(java.lang.String text)
Detects the language of the specified text.java.util.Optional<Language>
detect(java.lang.String text, TextFormat format)
Detects the language of the specified text.-
Methods inherited from class com.github.vbauer.yta.service.basic.AbstractApi
callMethod, client, converter
-
-
-
-
Field Detail
-
METHOD_DETECT
public static final java.lang.String METHOD_DETECT
- See Also:
- Constant Field Values
-
ATTR_TEXT
public static final java.lang.String ATTR_TEXT
- See Also:
- Constant Field Values
-
ATTR_FORMAT
public static final java.lang.String ATTR_FORMAT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DetectionApiImpl
public DetectionApiImpl(ApiContext context)
-
-
Method Detail
-
detect
@Nonnull public java.util.Optional<Language> detect(@Nullable java.lang.String text)
Detects the language of the specified text. Text format isTextFormat.PLAIN_TEXT
.- Specified by:
detect
in interfaceDetectionApi
- Parameters:
text
- the text to detect the language for- Returns:
- detected language
-
detect
@Nonnull public java.util.Optional<Language> detect(@Nullable java.lang.String text, @Nullable TextFormat format)
Detects the language of the specified text.- Specified by:
detect
in interfaceDetectionApi
- Parameters:
text
- the text to detect the language forformat
- text format: html or plain text- Returns:
- detected language
-
-