public abstract class AbstractBilingualDictionaryWithLongestMatchSearchService extends AbstractLanguagePairService implements BilingualDictionaryWithLongestMatchSearchService
ALL_MATCHINGMETHODS, EMPTY_LANGUAGEPAIRS, EMPTY_LANGUAGEPATHS, EMPTY_LANGUAGES, MINIMUM_MATCHINGMETHODS
Constructor and Description |
---|
AbstractBilingualDictionaryWithLongestMatchSearchService()
Constructor.
|
AbstractBilingualDictionaryWithLongestMatchSearchService(Collection<LanguagePair> supportedPairs)
Constructor.
|
AbstractBilingualDictionaryWithLongestMatchSearchService(ServiceContext serviceContext) |
Modifier and Type | Method and Description |
---|---|
static void |
clearCache() |
protected Calendar |
doGetLastUpdate() |
protected abstract Collection<Translation> |
doSearch(Language headLang,
Language targetLang,
String headWord,
MatchingMethod matchingMethod)
Searches the bilingual dictionary using the specified search term(s) and matching method, and returns bilingual translation.
|
protected Collection<TranslationWithPosition> |
doSearchLongestMatchingTerms(Language headLang,
Language targetLang,
Morpheme[] morphemes) |
String[] |
getSupportedMatchingMethods()
Returns the search methods supported by the dictionary wrapper.
|
protected boolean |
isCacheSearchResult() |
protected Collection<TranslationWithPosition> |
scan(Language headLang,
Language targetLang,
Morpheme[] morphemes)
Runs a scan.
|
Translation[] |
search(String headLang,
String targetLang,
String headWord,
String matchingMethod)
Searches the bilingual dictionary using the specified search term(s) and matching method, and returns bilingual translation.
|
TranslationWithPosition[] |
searchLongestMatchingTerms(String headLang,
String targetLang,
Morpheme[] morphemes)
Runs a search based on an array of morphemes.
|
void |
setCacheSearchResult(boolean cacheSearchResult) |
void |
setCacheTtlSec(int cacheTtlSec) |
protected void |
setSupportedMatchingMethods(Set<MatchingMethod> supportedMatchingMethods)
Sets supported search methods.
|
getSupportedLanguagePairCollection, getSupportedLanguagePairs, setSupportedLanguagePairs
acquireSemaphore, checkStartupException, convertLanguagePairs, convertLanguages, 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, setStartupException
getComponentServiceFactory, getFile, getServiceName, setComponentServiceFactory, setServiceName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLastUpdate, getSupportedLanguagePairs
public AbstractBilingualDictionaryWithLongestMatchSearchService()
public AbstractBilingualDictionaryWithLongestMatchSearchService(ServiceContext serviceContext)
public AbstractBilingualDictionaryWithLongestMatchSearchService(Collection<LanguagePair> supportedPairs)
supportedPairs
- Set of supported language pairspublic void setCacheSearchResult(boolean cacheSearchResult)
public void setCacheTtlSec(int cacheTtlSec)
public Translation[] search(String headLang, String targetLang, String headWord, String matchingMethod) throws AccessLimitExceededException, InvalidParameterException, LanguagePairNotUniquelyDecidedException, NoAccessPermissionException, NoValidEndpointsException, ProcessFailedException, ServerBusyException, ServiceNotActiveException, ServiceNotFoundException, UnsupportedLanguagePairException, UnsupportedMatchingMethodException
BilingualDictionaryService
search
in interface BilingualDictionaryService
headLang
- Source language of bilingual translation(RFC3066 compliant)targetLang
- Target language of bilingual translation (RFC3066 compliant)headWord
- Bilingual translation search phrasematchingMethod
- Matching method (one of either "COMPLETE","PREFIX","SUFFIX","PARTIAL","REGEX")AccessLimitExceededException
- Violated an access restrictionInvalidParameterException
- One of either headLang,targetLang,searchMethod is null or else is an empty string. headLang or targetLang do not comply with RFC3066.String not provided for by searchMethodLanguagePairNotUniquelyDecidedException
- The bilingual translation language pair candidates could not be singly resolved(Ex:When headLang, or else targetLang is specified as zh, the case where zh-Hans and zh-Hant both exist as supported language pairs)UnsupportedLanguagePairException
- The specified language pair is not supported.UnsupportedMatchingMethodException
- The specified matching method is not supportedNoAccessPermissionException
- The user executing the call lacks execution privilegesNoValidEndpointsException
- There is no valid endpointProcessFailedException
- Search process failedServerBusyException
- The server is loaded and cannot process it.ServiceNotActiveException
- The service is not activeServiceNotFoundException
- The specified service was not foundpublic TranslationWithPosition[] searchLongestMatchingTerms(String headLang, String targetLang, Morpheme[] morphemes) throws AccessLimitExceededException, InvalidParameterException, LanguagePairNotUniquelyDecidedException, NoAccessPermissionException, NoValidEndpointsException, ProcessFailedException, ServerBusyException, ServiceNotActiveException, ServiceNotFoundException, UnsupportedLanguagePairException, UnsupportedMatchingMethodException
BilingualDictionaryWithLongestMatchSearchService
searchLongestMatchingTerms
in interface BilingualDictionaryWithLongestMatchSearchService
headLang
- Source language of bilingual translation(RFC3066 compliant)targetLang
- Target language of bilingual translation (RFC3066 compliant)morphemes
- Array of morphemesAccessLimitExceededException
- Violated an access restrictionInvalidParameterException
- One of either headLang,targetLang,searchMethod is null or else is an empty string. headLang or targetLang do not comply with RFC3066.String not provided for by searchMethodLanguagePairNotUniquelyDecidedException
- The bilingual translation language pair candidates could not be singly resolved(Ex:When headLang, or else targetLang is specified as zh, the case where zh-Hans and zh-Hant both exist as supported language pairs)UnsupportedLanguagePairException
- The specified language pair is not supported.UnsupportedMatchingMethodException
- The specified matching method is not supportedNoAccessPermissionException
- The user executing the call lacks execution privilegesNoValidEndpointsException
- There is no valid endpointProcessFailedException
- Search process failedServerBusyException
- The server is loaded and cannot process it.ServiceNotActiveException
- The service is not activeServiceNotFoundException
- The specified service was not foundpublic String[] getSupportedMatchingMethods() throws AccessLimitExceededException, NoAccessPermissionException, NoValidEndpointsException, ProcessFailedException, ServerBusyException, ServiceNotActiveException, ServiceNotFoundException
BilingualDictionaryService
getSupportedMatchingMethods
in interface BilingualDictionaryService
AccessLimitExceededException
- Violated an access restrictionNoAccessPermissionException
- The user executing the call lacks execution privilegesNoValidEndpointsException
- There is no valid endpointProcessFailedException
- Search process failedServerBusyException
- The server is loaded and cannot process it.ServiceNotActiveException
- The service is not activeServiceNotFoundException
- The specified service was not foundpublic static void clearCache()
protected void setSupportedMatchingMethods(Set<MatchingMethod> supportedMatchingMethods)
supportedMatchingMethods
- Set of supported search methodsprotected abstract Collection<Translation> doSearch(Language headLang, Language targetLang, String headWord, MatchingMethod matchingMethod) throws InvalidParameterException, ProcessFailedException
headLang
- Source language of bilingual translation(RFC3066 compliant)targetLang
- Target language of bilingual translation (RFC3066 compliant)headWord
- Bilingual translation search languagematchingMethod
- Search methodInvalidParameterException
- One of either headLang,targetLang,matchingMethod is null or else is an empty string. headLang or targetLang do not comply with RFC3066.String not provided for by matchingMethodProcessFailedException
- Bilingual translation search failed due to some causeprotected Collection<TranslationWithPosition> doSearchLongestMatchingTerms(Language headLang, Language targetLang, Morpheme[] morphemes) throws InvalidParameterException, ProcessFailedException
protected Calendar doGetLastUpdate() throws ProcessFailedException
doGetLastUpdate
in class AbstractService
ProcessFailedException
protected Collection<TranslationWithPosition> scan(Language headLang, Language targetLang, Morpheme[] morphemes) throws InvalidParameterException, ProcessFailedException
languages
- Bilingual translation languagesmorphemes
- Array of morphemesInvalidParameterException
- One of either headLang,targetLang,matchingMethod is null or else is an empty string. headLang or targetLang do not comply with RFC3066.String not provided for by matchingMethodProcessFailedException
- Bilingual translation search failed due to some causeprotected boolean isCacheSearchResult()