public class MosesTranslator extends ExternalTranslator
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isAvailable() |
String |
translate(String text,
String sourceLanguage,
String targetLanguage)
Translate text between given languages.
|
checkCommand, runAndGetOutput, translate
public MosesTranslator()
AssertionError
- When the properties file is unreadable.public String translate(String text, String sourceLanguage, String targetLanguage) throws TikaException, IOException
Translator
text
- The text to translate.sourceLanguage
- The input text language (for example, "en").targetLanguage
- The desired language to translate to (for example, "fr").TikaException
- When there is an error translating.IOException
public boolean isAvailable()
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.