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 Exception
Translator
text
- The text to translate.sourceLanguage
- The input text language (for example, "en").targetLanguage
- The desired language to translate to (for example, "fr").Exception
- When there is an error with the API call.public boolean isAvailable()
Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.