|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ow2.weblab.service.translate.moses.MosesTranslator
public class MosesTranslator
MosesParser hide command line usage. Takes a moses.ini file as parameter and enables direct String translation
| Field Summary | |
|---|---|
protected java.io.BufferedReader |
br
Use it to read the translation response |
protected java.io.BufferedWriter |
bw
Use it to writes the translation request |
static java.lang.String |
DEFAULT_ESCAPED_REG_EXP
Default value for escaped regular expression |
protected java.lang.String |
escapedRegExp
Escaped regular expression |
protected java.lang.String |
langCode
ISO 639-1 code language |
protected static org.apache.commons.logging.Log |
LOGGER
Logger |
protected java.lang.String |
mosesIniPath
Path to the moses.ini file. |
| Constructor Summary | |
|---|---|
MosesTranslator(java.lang.String mosesIniPath,
java.lang.String langCode)
Creates a MosesParser using a moses.ini file with the default escaped regular expression |
|
MosesTranslator(java.lang.String mosesIniPath,
java.lang.String langCode,
java.lang.String escapedRegExp)
Creates a MosesParser using a moses.ini file. |
|
| Method Summary | |
|---|---|
protected java.lang.String |
cleanString(java.lang.String toBeCleaned)
|
java.lang.String |
getLangCode()
Return the translated language code using ISO 639-1 |
protected void |
launchCommand()
Launch the moses -f moses.ini command. |
java.lang.String |
toString()
|
java.lang.String |
translate(java.lang.String toBeTranslated)
Translate into another language using previously defined moses.ini file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String escapedRegExp
public static final java.lang.String DEFAULT_ESCAPED_REG_EXP
protected java.lang.String langCode
protected java.lang.String mosesIniPath
protected java.io.BufferedReader br
protected java.io.BufferedWriter bw
protected static org.apache.commons.logging.Log LOGGER
| Constructor Detail |
|---|
public MosesTranslator(java.lang.String mosesIniPath,
java.lang.String langCode,
java.lang.String escapedRegExp)
throws java.io.IOException
mosesIniPath - path to moses.ini filelangCode - destination language codeescapedRegExp - regular expression used to escape some char not well used by
moses
java.io.IOException - Something is wrong in the moses configuration file
public MosesTranslator(java.lang.String mosesIniPath,
java.lang.String langCode)
throws java.io.IOException
mosesIniPath - path to moses.ini filelangCode - destination language code
java.io.IOException - Something is wrong in the moses configuration file| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Object
protected void launchCommand()
throws java.io.IOException
java.io.IOException - something wring when trying to invoke the command line
public java.lang.String translate(java.lang.String toBeTranslated)
throws java.io.IOException
translate in interface TranslatortoBeTranslated - the String to be translated in
java.io.IOException - something wrong during the translationprotected java.lang.String cleanString(java.lang.String toBeCleaned)
public java.lang.String getLangCode()
getLangCode in interface Translator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||