public class MicrosoftMTConnector extends BaseConnector implements ITMQuery
| Constructor and Description |
|---|
MicrosoftMTConnector() |
MicrosoftMTConnector(org.apache.http.impl.client.CloseableHttpClient httpClient) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> List<List<QueryResult>> |
_batchQuery(List<String> texts,
List<T> originalText,
net.sf.okapi.connectors.microsoft.QueryResultBuilder<T> qrBuilder) |
protected <T> int |
_query(String queryText,
T originalText,
net.sf.okapi.connectors.microsoft.QueryResultBuilder<T> resultBuilder) |
protected <T> List<List<QueryResult>> |
_subBatchQuery(List<String> texts,
List<T> originalText,
net.sf.okapi.connectors.microsoft.QueryResultBuilder<T> qrBuilder) |
void |
batchLeverage(List<ITextUnit> tuList)
Slow default implementation using leverage(TextUnit).
|
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)
Starts a batch query for a given list of plain texts.
|
void |
close()
Closes this connector.
|
int |
getMaximumHits()
Gets the current maximum number of hits to retrieve.
|
String |
getName()
Gets the name of the connector.
|
Parameters |
getParameters()
Gets the current parameters of this connector.
|
String |
getSettingsDisplay()
Gets a display representation of the current settings for this connector.
|
int |
getThreshold()
Gets the current threshold value to use for the query.
|
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 frag)
Starts a query for a given text.
|
void |
setLanguages(LocaleId sourceLocale,
LocaleId targetLocale)
Sets the source and target languages for this query engine.
|
void |
setMaximumHits(int maximumHits)
Sets the maximum number of hits to retrieve.
|
void |
setParameters(IParameters params)
Sets the parameters for opening and querying this connector.
|
void |
setThreshold(int threshold)
Sets the threshold value to use for the query.
|
protected String |
toInternalCode(LocaleId locale)
Converts a locale identifier to the internal string value for a language/locale code for this connector.
|
batchLeverageUsingBatchQuery, clearAttributes, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, leverageUsingBatchQuery, removeAttribute, setAttribute, setNoQueryThreshold, setRootDirectory, setWeightclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearAttributes, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, removeAttribute, setAttribute, setNoQueryThreshold, setRootDirectory, setWeightforEachRemaining, removepublic MicrosoftMTConnector()
public MicrosoftMTConnector(org.apache.http.impl.client.CloseableHttpClient httpClient)
public void close()
IQueryclose in interface AutoCloseableclose in interface IQuerypublic String getName()
IQuerypublic String getSettingsDisplay()
IQuerygetSettingsDisplay in interface IQuerypublic void open()
IQueryprotected <T> int _query(String queryText, T originalText, net.sf.okapi.connectors.microsoft.QueryResultBuilder<T> resultBuilder)
public int query(String plainText)
IQuerypublic int query(TextFragment frag)
IQueryprotected <T> List<List<QueryResult>> _batchQuery(List<String> texts, List<T> originalText, net.sf.okapi.connectors.microsoft.QueryResultBuilder<T> qrBuilder)
protected <T> List<List<QueryResult>> _subBatchQuery(List<String> texts, List<T> originalText, net.sf.okapi.connectors.microsoft.QueryResultBuilder<T> qrBuilder)
public void leverage(ITextUnit tu)
IQueryleverage in interface IQueryleverage in class BaseConnectortu - the text unit to leverage.public void batchLeverage(List<ITextUnit> tuList)
BaseConnectorbatchLeverage in interface IQuerybatchLeverage in class BaseConnectortuList - list of the text units to process.public List<List<QueryResult>> batchQueryText(List<String> plainTexts)
IQuerybatchQueryText in interface IQuerybatchQueryText in class BaseConnectorplainTexts - list of the plain texts to translate.public List<List<QueryResult>> batchQuery(List<TextFragment> fragments)
BaseConnectorbatchQuery in interface IQuerybatchQuery in class BaseConnectorfragments - list of the text fragments to translate.protected String toInternalCode(LocaleId locale)
BaseConnectortoInternalCode in class BaseConnectorlocale - the locale identifier to convert.public Parameters getParameters()
IQuerygetParameters in interface IQuerygetParameters in class BaseConnectorpublic void setParameters(IParameters params)
IQuerysetParameters in interface IQuerysetParameters in class BaseConnectorparams - the parameters to set.public boolean hasNext()
IQueryhasNext in interface Iterator<QueryResult>hasNext in interface IQueryhasNext in class BaseConnectorpublic QueryResult next()
IQuerynext in interface Iterator<QueryResult>next in interface IQuerynext in class BaseConnectorpublic int getMaximumHits()
ITMQuerygetMaximumHits in interface ITMQuerypublic void setMaximumHits(int maximumHits)
ITMQuerysetMaximumHits in interface ITMQuerymaximumHits - The maximum number of hits to retrieve.public int getThreshold()
ITMQuerygetThreshold in interface ITMQuerypublic void setThreshold(int threshold)
ITMQuerysetThreshold in interface ITMQuerythreshold - The threshold value (between 0 and 100).public void setLanguages(LocaleId sourceLocale, LocaleId targetLocale)
IQuerysetLanguages in interface IQuerysetLanguages in class BaseConnectorsourceLocale - Code of the source locale.targetLocale - Code of the target locale.Copyright © 2021. All rights reserved.