public abstract class BaseConnector extends Object implements IQuery
IQuery interface.| Modifier and Type | Field and Description |
|---|---|
protected int |
current |
protected QueryResult |
result |
protected String |
srcCode |
protected LocaleId |
srcLoc |
protected String |
trgCode |
protected LocaleId |
trgLoc |
| Constructor and Description |
|---|
BaseConnector() |
| Modifier and Type | Method and Description |
|---|---|
void |
batchLeverage(List<ITextUnit> tus)
Slow default implementation using leverage(TextUnit).
|
protected void |
batchLeverageUsingBatchQuery(List<ITextUnit> tuList)
Call this method inside the overriding
batchLeverage(List) method
of the derived class, if that class offers a fast batchQuery(List) method. |
List<List<QueryResult>> |
batchQuery(List<TextFragment> fragments)
Slow default implementation using query!!
Override to take advantage of servers batch API
|
List<List<QueryResult>> |
batchQueryText(List<String> plainTexts) |
void |
clearAttributes() |
int |
getNoQueryThreshold() |
IParameters |
getParameters() |
LocaleId |
getSourceLanguage() |
LocaleId |
getTargetLanguage() |
int |
getWeight() |
boolean |
hasNext() |
void |
leverage(ITextUnit tu) |
protected void |
leverageUsingBatchQuery(ITextUnit tu)
Call this method inside the overriding
leverage(ITextUnit) method
of the derived class, if that class offers a fast batchQuery(List) method. |
QueryResult |
next() |
void |
removeAttribute(String name) |
void |
setAttribute(String name,
String value) |
void |
setLanguages(LocaleId sourceLocale,
LocaleId targetLocale) |
void |
setNoQueryThreshold(int noQueryThreshold) |
void |
setParameters(IParameters params) |
void |
setRootDirectory(String rootDir) |
void |
setWeight(int weight) |
protected String |
toInternalCode(LocaleId locId)
Converts a locale identifier to the internal string value for a language/locale code for this connector.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getName, getSettingsDisplay, open, query, queryforEachRemaining, removeprotected LocaleId srcLoc
protected String srcCode
protected LocaleId trgLoc
protected String trgCode
protected QueryResult result
protected int current
public LocaleId getSourceLanguage()
getSourceLanguage in interface IQuerypublic LocaleId getTargetLanguage()
getTargetLanguage in interface IQuerypublic void setLanguages(LocaleId sourceLocale, LocaleId targetLocale)
setLanguages in interface IQuerypublic boolean hasNext()
hasNext in interface Iterator<QueryResult>hasNext in interface IQuerypublic QueryResult next()
next in interface Iterator<QueryResult>next in interface IQuerypublic void clearAttributes()
clearAttributes in interface IQuerypublic void removeAttribute(String name)
removeAttribute in interface IQuerypublic void setAttribute(String name, String value)
setAttribute in interface IQuerypublic void setRootDirectory(String rootDir)
setRootDirectory in interface IQuerypublic IParameters getParameters()
getParameters in interface IQuerypublic void setParameters(IParameters params)
setParameters in interface IQuerypublic List<List<QueryResult>> batchQueryText(List<String> plainTexts)
batchQueryText in interface IQuerypublic List<List<QueryResult>> batchQuery(List<TextFragment> fragments)
batchQuery in interface IQuerypublic void batchLeverage(List<ITextUnit> tus)
batchLeverage in interface IQuerytus - list of the text units to process.public void setNoQueryThreshold(int noQueryThreshold)
setNoQueryThreshold in interface IQuerypublic int getNoQueryThreshold()
getNoQueryThreshold in interface IQueryprotected void leverageUsingBatchQuery(ITextUnit tu)
leverage(ITextUnit) method
of the derived class, if that class offers a fast batchQuery(List) method.tu - the text unit to leverage.protected void batchLeverageUsingBatchQuery(List<ITextUnit> tuList)
batchLeverage(List) method
of the derived class, if that class offers a fast batchQuery(List) method.tuList - list of the text units to leverage.protected String toInternalCode(LocaleId locId)
locId - the locale identifier to convert.Copyright © 2022. All rights reserved.