public interface IQuery extends AutoCloseable, Iterator<QueryResult>
| Modifier and Type | Method and Description |
|---|---|
void |
batchLeverage(List<ITextUnit> tus)
Leverages a batch of text units (segmented or not) based on the current settings.
|
List<List<QueryResult>> |
batchQuery(List<TextFragment> fragments)
Starts a batch query for a given list of
TextFragments. |
List<List<QueryResult>> |
batchQueryText(List<String> plainTexts)
Starts a batch query for a given list of plain texts.
|
void |
clearAttributes()
Removes all attributes from this query engine.
|
void |
close()
Closes this connector.
|
String |
getName()
Gets the name of the connector.
|
int |
getNoQueryThreshold()
Gets the threshold for when to avoid a query.
|
IParameters |
getParameters()
Gets the current parameters of this connector.
|
String |
getSettingsDisplay()
Gets a display representation of the current settings for this connector.
|
LocaleId |
getSourceLanguage()
Gets the current source language for this query engine.
|
LocaleId |
getTargetLanguage()
Gets the current target language for this query engine.
|
int |
getWeight()
Get the weight for this connector.
|
boolean |
hasNext()
Indicates of there is a hit available.
|
void |
leverage(ITextUnit tu)
Leverages a text unit (segmented or not) based on the current settings.
|
QueryResult |
next()
Gets the next hit for the last query.
|
void |
open()
Opens this query engine.
|
int |
query(String plainText)
Starts a query for a give plain text.
|
int |
query(TextFragment text)
Starts a query for a given text.
|
void |
removeAttribute(String name)
Removes a given attribute from this query engine.
|
void |
setAttribute(String name,
String value)
Sets an attribute for this query engine.
|
void |
setLanguages(LocaleId sourceLocale,
LocaleId targetLocale)
Sets the source and target languages for this query engine.
|
void |
setNoQueryThreshold(int noQueryThreshold)
Sets the threshold for when to avoid executing a query.
|
void |
setParameters(IParameters params)
Sets the parameters for opening and querying this connector.
|
void |
setRootDirectory(String rootDir)
Sets the root directory that may be used to replace the available ${rootDir} in the
parameters of this object.
|
void |
setWeight(int weight)
Set the relative weight of this
IQuery connector as compared to
other connectors. |
forEachRemaining, removeString getName()
String getSettingsDisplay()
void setLanguages(LocaleId sourceLocale, LocaleId targetLocale)
sourceLocale - Code of the source locale.targetLocale - Code of the target locale.LocaleId getSourceLanguage()
LocaleId getTargetLanguage()
void setAttribute(String name, String value)
name - name of the attribute.value - Value of the attribute.void removeAttribute(String name)
name - The name of the attribute to remove.void clearAttributes()
void setParameters(IParameters params)
params - the parameters to set.IParameters getParameters()
void open()
void close()
close in interface AutoCloseableint query(String plainText)
plainText - text to query.int query(TextFragment text)
text - The text to query.void leverage(ITextUnit tu)
tu - the text unit to leverage.void batchLeverage(List<ITextUnit> tus)
tus - of the text unit to leverage.List<List<QueryResult>> batchQueryText(List<String> plainTexts)
plainTexts - list of the plain texts to translate.List<List<QueryResult>> batchQuery(List<TextFragment> fragments)
TextFragments.
Some IQuery implementations are significantly faster when
a using batch query.
fragments - list of the text fragments to translate.boolean hasNext()
hasNext in interface Iterator<QueryResult>QueryResult next()
next in interface Iterator<QueryResult>void setRootDirectory(String rootDir)
rootDir - the root directory.void setWeight(int weight)
IQuery connector as compared to
other connectors. Used to set QueryResult.weight.weight - the new relative weight.int getWeight()
void setNoQueryThreshold(int noQueryThreshold)
If the entry to leverage has already one candidate with a score equals or above this value, no query is performed. Use 101 to always allow the query.
noQueryThreshold - no-query threshold (a value between 0 and 101).int getNoQueryThreshold()
Copyright © 2022. All rights reserved.