public abstract class AbstractTranslationService extends AbstractLanguagePairService implements TranslationService, BackTranslationService, MultihopTranslationService
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractTranslationService.DivisionType |
ALL_MATCHINGMETHODS, EMPTY_LANGUAGEPAIRS, EMPTY_LANGUAGEPATHS, EMPTY_LANGUAGES, MINIMUM_MATCHINGMETHODS| Constructor and Description |
|---|
AbstractTranslationService()
Constructor that doesn't take parameter(s).
|
AbstractTranslationService(ServiceContext serviceContext)
Constructor that takes the service context as a parameter(s).
|
AbstractTranslationService(ServiceContext serviceContext,
Collection<LanguagePair> supportedPairs)
Constructor that takes the service context and supported language pair(s) as a parameter(s).
|
| Modifier and Type | Method and Description |
|---|---|
BackTranslationResult |
backTranslate(String sourceLang,
String interMediateLang,
String source)
Runs back translation.
|
protected String[] |
doMultistatementTranslation(Language sourceLang,
Language targetLang,
String[] sources) |
protected abstract String |
doTranslation(Language sourceLang,
Language targetLang,
String source)
Template method supporting transtlate.
|
MultihopTranslationResult |
multihopTranslate(String sourceLang,
String[] intermediateLangs,
String targetLang,
String source)
When the LanguagePathNotUnizuelyDecidedException occurs, only one language path data is returned as a candidate.
|
String |
multistatementTranslate(String sourceLang,
String targetLang,
String source,
String delimiterRegx) |
void |
setMaxSourceLength(int maxSourceLength) |
void |
setSentenceDivision(AbstractTranslationService.DivisionType sentenceDivision) |
String |
translate(String sourceLang,
String targetLang,
String source)
Run translation.
|
protected LanguagePair |
validateLanguagePair(LanguagePairValidator languagePair) |
getSupportedLanguagePairCollection, getSupportedLanguagePairs, setSupportedLanguagePairsacquireSemaphore, checkStartupException, convertLanguagePairs, convertLanguages, doGetLastUpdate, getCurrentServiceContext, getDoDoubleSearch, getEliminateDuplicates, getInitParameter, getInitParameterBoolean, getInitParameterInt, getInitParameterLong, getInitParameters, getInitParameterString, getInitParameterUsingTransformer, getLastUpdate, getLogListener, getMaxResults, getMaxWaitMillisForExternalProcess, getRequestMimeHeaders, getServiceContext, getWorkDirectory, getWorkFile, log, parseDateMacro, processEnd, processEnd, processLap, processStart, releaseSemaphore, setCurrentServiceContext, setDoubleSearchResults, setEliminateDuplicates, setLogListener, setMaxResults, setMaxThreads, setMaxWaitMillisForExternalProcess, setMaxWaitMillisForThread, setMeasureProcessTime, setProcessTimeWarningThreasholdMillis, setStartupExceptiongetComponentServiceFactory, getFile, getServiceName, setComponentServiceFactory, setServiceNamepublic AbstractTranslationService()
public AbstractTranslationService(ServiceContext serviceContext)
serviceContext - Service contextpublic AbstractTranslationService(ServiceContext serviceContext, Collection<LanguagePair> supportedPairs)
serviceContext - Service contextsupportedPairs - Supported language pairspublic void setMaxSourceLength(int maxSourceLength)
public void setSentenceDivision(AbstractTranslationService.DivisionType sentenceDivision)
public String translate(String sourceLang, String targetLang, String source) throws AccessLimitExceededException, InvalidParameterException, LanguagePairNotUniquelyDecidedException, NoAccessPermissionException, NoValidEndpointsException, ProcessFailedException, ServerBusyException, ServiceNotActiveException, ServiceNotFoundException, UnsupportedLanguagePairException
TranslationServicetranslate in interface TranslationServicesourceLang - Translation source language (RFC3066 compliant)targetLang - Target language of the translation (RFC3066 compliant)source - String to be translatedAccessLimitExceededException - Violated an access restrictionInvalidParameterException - An invalid parameter was passedLanguagePairNotUniquelyDecidedException - Multiple candidate language pairs existUnsupportedLanguagePairException - An unsupported language pair was specifiedNoAccessPermissionException - The user executing the call lacks execution privilegesNoValidEndpointsException - There is no valid endpointProcessFailedException - Translation process failedServerBusyException - The server is loaded and cannot process it.ServiceNotActiveException - The service is not activeServiceNotFoundException - The specified service was not foundpublic final BackTranslationResult backTranslate(String sourceLang, String interMediateLang, String source) throws AccessLimitExceededException, InvalidParameterException, LanguagePairNotUniquelyDecidedException, NoAccessPermissionException, NoValidEndpointsException, ProcessFailedException, ServerBusyException, ServiceNotActiveException, UnsupportedLanguagePairException
BackTranslationServicebackTranslate in interface BackTranslationServicesourceLang - Translation source language (RFC3066 compliant)interMediateLang - Intermediate language (RFC3066 compliant)source - String to be translatedAccessLimitExceededException - Violated an access restrictionInvalidParameterException - An invalid parameter was passedLanguagePairNotUniquelyDecidedException - Multiple candidate language pairs existUnsupportedLanguagePairException - An unsupported language pair was specifiedNoAccessPermissionException - The user executing the call lacks execution privilegesNoValidEndpointsException - There is no valid endpointProcessFailedException - Response search failed due to some causeServerBusyException - The server is loaded and cannot process it.ServiceNotActiveException - The service is not activepublic final MultihopTranslationResult multihopTranslate(String sourceLang, String[] intermediateLangs, String targetLang, String source) throws AccessLimitExceededException, InvalidParameterException, LanguagePathNotUniquelyDecidedException, NoAccessPermissionException, NoValidEndpointsException, ProcessFailedException, ServerBusyException, ServiceNotActiveException, UnsupportedLanguagePathException
When the LanguagePathNotUnizuelyDecidedException occurs, only one language path data is returned as a candidate. (It is not a formal interface, so the constructor of the language path data is omitted).
multihopTranslate in interface MultihopTranslationServicesourceLang - Translation source language (RFC3066 compliant)intermediateLangs - Intermediate languages (RFC3066 compliant)targetLang - Target language of the translation (RFC3066 compliant)source - String to be translatedAccessLimitExceededException - Violated an access restrictionInvalidParameterException - An invalid parameter was passedLanguagePathNotUniquelyDecidedException - Multiple language path candidates were foundUnsupportedLanguagePathException - An unsupported language path was specifiedNoAccessPermissionException - The user executing the call lacks execution privilegesNoValidEndpointsException - There is no valid endpointProcessFailedException - Translation process failedServerBusyException - The server is loaded and cannot process it.ServiceNotActiveException - Service not activepublic final String multistatementTranslate(String sourceLang, String targetLang, String source, String delimiterRegx) throws AccessLimitExceededException, InvalidParameterException, LanguagePairNotUniquelyDecidedException, NoAccessPermissionException, NoValidEndpointsException, ProcessFailedException, ServerBusyException, ServiceNotActiveException, ServiceNotFoundException, UnsupportedLanguagePairException
protected String[] doMultistatementTranslation(Language sourceLang, Language targetLang, String[] sources) throws InvalidParameterException, ProcessFailedException
protected abstract String doTranslation(Language sourceLang, Language targetLang, String source) throws InvalidParameterException, ProcessFailedException
sourceLang - Source languagetargetLang - Target languagesource - String to be translatedInvalidParameterException - An invalid parameter was passedProcessFailedException - Process failedprotected LanguagePair validateLanguagePair(LanguagePairValidator languagePair) throws InvalidParameterException, LanguagePairNotUniquelyDecidedException, UnsupportedLanguagePairException
languagePair - InvalidParameterException - An invalid parameter was passedLanguagePairNotUniquelyDecidedException - Multiple candidate language pairs existUnsupportedLanguagePairException - An unsupported language pair was specified