Class Lingo24Translator
- java.lang.Object
-
- org.apache.tika.language.translate.AbstractTranslator
-
- org.apache.tika.language.translate.Lingo24Translator
-
- All Implemented Interfaces:
Translator
public class Lingo24Translator extends AbstractTranslator
An implementation of a REST client for the Premium MT API v1. You can sign up for an access plan online on the Lingo24 Developer Portal and set your Application's User Key in thetranslator.lingo24.properties
file.
-
-
Constructor Summary
Constructors Constructor Description Lingo24Translator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isAvailable()
String
translate(String text, String targetLanguage)
Translate text to the given language This method attempts to auto-detect the source language of the text.String
translate(String text, String sourceLanguage, String targetLanguage)
Translate text between given languages.-
Methods inherited from class org.apache.tika.language.translate.AbstractTranslator
detectLanguage
-
-
-
-
Method Detail
-
translate
public String translate(String text, String sourceLanguage, String targetLanguage) throws TikaException, IOException
Description copied from interface:Translator
Translate text between given languages.- Parameters:
text
- The text to translate.sourceLanguage
- The input text language (for example, "en").targetLanguage
- The desired language to translate to (for example, "fr").- Returns:
- The translation result. If translation is unavailable, returns the same text back.
- Throws:
TikaException
- When there is an error translating.IOException
-
translate
public String translate(String text, String targetLanguage) throws TikaException, IOException
Description copied from interface:Translator
Translate text to the given language This method attempts to auto-detect the source language of the text.- Parameters:
text
- The text to translate.targetLanguage
- The desired language to translate to (for example, "hi").- Returns:
- The translation result. If translation is unavailable, returns the same text back.
- Throws:
TikaException
- When there is an error translating.IOException
-
isAvailable
public boolean isAvailable()
- Returns:
- true if this Translator is probably able to translate right now.
-
-