de.folt.models.datamodel.mtmoses
Class MTMoses

java.lang.Object
  extended by java.util.Observable
      extended by de.folt.models.datamodel.BasicDataSource
          extended by de.folt.models.datamodel.mtmoses.MTMoses
All Implemented Interfaces:
DataSource, java.util.Enumeration<MultiLingualObject>, java.util.Observer

public class MTMoses
extends BasicDataSource

Author:
klemens To change the template for this generated type comment go to Window - Preferences - Java - Code Generation - Code and Comments

Nested Class Summary
 
Nested classes/interfaces inherited from class de.folt.models.datamodel.BasicDataSource
BasicDataSource.BasicDataSourceObserver
 
Constructor Summary
MTMoses()
           
MTMoses(DataSourceProperties dataSourceProperties)
           
MTMoses(java.lang.String propertiesFileName)
           
 
Method Summary
 boolean createDataSource(DataSourceProperties dataModelProperties)
          createDataSource creates a new Data source; this is esp. intended for creating a new database, e.g. in MySQL or Ms SQL Server.
 java.lang.String getDataSourceType()
          getDataSourceType get the type of the database
static void main(java.lang.String[] args)
           
 java.util.Vector<java.lang.String> runMoses(java.lang.String inFile)
          runMoses translate a given segment
 java.lang.String start()
          startMoses start the moses in input / output mode
 boolean stop()
          stop stop the moses process
 org.jdom.Element translate(org.jdom.Element transUnit, org.jdom.Element file, XliffDocument xliffDocument, java.lang.String sourceLanguage, java.lang.String targetLanguage, int matchSimilarity, java.util.Hashtable<java.lang.String,java.lang.Object> translationParameters)
          translate translates a trans-unit given the source language, target Language and match similarity
 java.lang.String translate(java.lang.String segment)
          translate translate a segment
 
Methods inherited from class de.folt.models.datamodel.BasicDataSource
addData, addMonoLingualObject, addMultiLingualObject, bAuthenticate, bPersist, bSupportMultiThreading, changedMonolingualObjects, checkIfTranslationExistsInDataSource, checkIfTranslationExistsInDataSource, cleanDataSource, clearDataSource, containsKey, containsValue, copyFrom, copyTo, currentTimeMillis, deleteDataSource, exportTmxFile, exportXliffFile, getAllAttributes, getChangedIds, getData, getDataSourceName, getDataSourceProperties, getDefaultDataSourceConfigurationsFileName, getFuzzyTree, getIds, getILogLevel, getLastErrorCode, getMonoLingualObjectFromId, getMonoLingualObjectFromUniqueId, getMultiLingualObjectCache, getMultiLingualObjectFromId, getMultiLingualObjectFromUniqueId, getUniqueIds, hasMoreElements, importTbxFile, importTmxFile, importXliffFile, initEnumeration, isBChanged, isBLoadAttributesLazy, isSyncDataSource, nextElement, removeData, removeDataSource, removeMonoLingualObject, removeMultiLingualObject, runFilterMethod, saveModifiedMonoLingualObject, saveModifiedMultiLingualObject, search, searchRegExp, searchWordBased, setBChanged, setBLoadAttributesLazy, setDataSourceType, setDefaultDataSourceConfigurationsFileName, setILogLevel, setILogLevel, setLastErrorCode, setMultiLingualObjectCache, setOpenTMSPropertiesFile, subSegmentResultsToGlossary, subSegmentTranslate, update, update
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTMoses

public MTMoses()

MTMoses

public MTMoses(DataSourceProperties dataSourceProperties)
Parameters:
dataSourceProperties -

MTMoses

public MTMoses(java.lang.String propertiesFileName)
Parameters:
propertiesFileName -
Method Detail

main

public static void main(java.lang.String[] args)

createDataSource

public boolean createDataSource(DataSourceProperties dataModelProperties)
                         throws OpenTMSException
Description copied from interface: DataSource
createDataSource creates a new Data source; this is esp. intended for creating a new database, e.g. in MySQL or Ms SQL Server. In addition it can be used to create a new empty TMX data source.

Specified by:
createDataSource in interface DataSource
Overrides:
createDataSource in class BasicDataSource
Parameters:
dataModelProperties - the parameters of the data source
Returns:
true if success
Throws:
OpenTMSException

getDataSourceType

public java.lang.String getDataSourceType()
Description copied from interface: DataSource
getDataSourceType get the type of the database

Specified by:
getDataSourceType in interface DataSource
Overrides:
getDataSourceType in class BasicDataSource
Returns:
the data source type

runMoses

public java.util.Vector<java.lang.String> runMoses(java.lang.String inFile)
runMoses translate a given segment

Parameters:
segment - the segment to translate
Returns:
the translated segment

start

public java.lang.String start()
startMoses start the moses in input / output mode

Returns:
the start output produces by Moses

stop

public boolean stop()
stop stop the moses process

Returns:
true in case of sucess

translate

public org.jdom.Element translate(org.jdom.Element transUnit,
                                  org.jdom.Element file,
                                  XliffDocument xliffDocument,
                                  java.lang.String sourceLanguage,
                                  java.lang.String targetLanguage,
                                  int matchSimilarity,
                                  java.util.Hashtable<java.lang.String,java.lang.Object> translationParameters)
                           throws OpenTMSException
Description copied from interface: DataSource
translate translates a trans-unit given the source language, target Language and match similarity

Specified by:
translate in interface DataSource
Overrides:
translate in class BasicDataSource
Parameters:
transUnit - the trans unit to translate to use
file - the file element currently to translate
xliffDocument - the basic xliff document
sourceLanguage - the source language to use
targetLanguage - the target language to use
matchSimilarity - the similarity (fuzzy) match quality (0 - 100) to use
translationParameters - the hash table contains parameters which control some parameters, e.g. should header/source/target properties be written to alt-trans
Returns:
the modified trans-unit with new translation
Throws:
OpenTMSException

translate

public java.lang.String translate(java.lang.String segment)
translate translate a segment

Parameters:
segment - the segment to translate
Returns:
the translates segment