Class MosesTranslator
- java.lang.Object
- 
- org.apache.tika.language.translate.impl.AbstractTranslator
- 
- org.apache.tika.language.translate.impl.ExternalTranslator
- 
- org.apache.tika.language.translate.impl.MosesTranslator
 
 
 
- 
- All Implemented Interfaces:
- Translator
 
 public class MosesTranslator extends ExternalTranslator Translator that uses the Moses decoder for translation. Users must install the Moses system before using this Translator. @link http://www.statmt.org/moses/.
- 
- 
Constructor SummaryConstructors Constructor Description MosesTranslator()Default constructor that attempts to read the smt jar and script paths from the translator.moses.properties file.MosesTranslator(String smtPath, String scriptPath)Create a Moses Translator with the specified smt jar and script paths.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisAvailable()Stringtranslate(String text, String sourceLanguage, String targetLanguage)Translate text between given languages.- 
Methods inherited from class org.apache.tika.language.translate.impl.ExternalTranslatorcheckCommand, runAndGetOutput, translate
 - 
Methods inherited from class org.apache.tika.language.translate.impl.AbstractTranslatordetectLanguage
 
- 
 
- 
- 
- 
Constructor Detail- 
MosesTranslatorpublic MosesTranslator() Default constructor that attempts to read the smt jar and script paths from the translator.moses.properties file.- Throws:
- AssertionError- When the properties file is unreadable.
 
 
- 
 - 
Method Detail- 
translatepublic String translate(String text, String sourceLanguage, String targetLanguage) throws TikaException, IOException Description copied from interface:TranslatorTranslate 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
 
 - 
isAvailablepublic boolean isAvailable() - Returns:
- true if this Translator is probably able to translate right now.
 
 
- 
 
-