public abstract class AbstractSimilarityCalculationService extends AbstractLanguageService implements SimilarityCalculationService
ALL_MATCHINGMETHODS, EMPTY_LANGUAGEPAIRS, EMPTY_LANGUAGEPATHS, EMPTY_LANGUAGES, MINIMUM_MATCHINGMETHODS| Constructor and Description |
|---|
AbstractSimilarityCalculationService()
Constructor that doesn't take parameter(s).
|
AbstractSimilarityCalculationService(Collection<Language> supportedLanguages)
Constructor that takes the set of supported languages as a parameter.
|
AbstractSimilarityCalculationService(ServiceContext serviceContext,
Collection<Language> supportedLanguages)
Constructor that takes the service context and supported language as a parameter(s).
|
| Modifier and Type | Method and Description |
|---|---|
double |
calculate(String language,
String sourceText,
String targetText)
Runs the text's similarity calculation.
|
protected abstract double |
doCalculation(Language language,
String text1,
String text2)
Execute similarity calculation.
|
getSupportedLanguageCollection, getSupportedLanguagePairCollection, getSupportedLanguages, setSupportedLanguageCollection, setSupportedLanguagesacquireSemaphore, 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 AbstractSimilarityCalculationService()
public AbstractSimilarityCalculationService(Collection<Language> supportedLanguages)
supportedLanguages - Set of supported languagespublic AbstractSimilarityCalculationService(ServiceContext serviceContext, Collection<Language> supportedLanguages)
serviceContext - Service contextsupportedLanguages - Set of supported languagespublic double calculate(String language, String sourceText, String targetText) throws AccessLimitExceededException, InvalidParameterException, LanguageNotUniquelyDecidedException, NoAccessPermissionException, NoValidEndpointsException, ProcessFailedException, ServerBusyException, ServiceNotActiveException, ServiceNotFoundException, UnsupportedLanguageException
SimilarityCalculationServicecalculate in interface SimilarityCalculationServicelanguage - Language of text(RFC3066 compliant)sourceText - Source text for comparison (required)targetText - Destination text for comparison (required)AccessLimitExceededException - Violated an access restrictionInvalidParameterException - One of either text1,text2,or language is null.language does not comply with RFC3066LanguageNotUniquelyDecidedException - A supported language candidate could not be singly determined (Ex: when the language is specified as zh, the case where zh-Hans and zh-Hant exist as supported languages)UnsupportedLanguageException - The specified language is not supportedNoAccessPermissionException - The user executing the call lacks execution privilegesNoValidEndpointsException - There is no valid endpointProcessFailedException - Calculation process failedServerBusyException - The server is loaded and cannot process it.ServiceNotActiveException - The service is not activeServiceNotFoundException - The specified service was not foundprotected abstract double doCalculation(Language language, String text1, String text2) throws InvalidParameterException, ProcessFailedException
language - Languagetext1 - Text to be calculated 1text2 - Text to be calculated 2InvalidParameterException - An invalid parameter was passedProcessFailedException - Process failed