public class GoogleMTv2Connector extends BaseConnector
| Constructor and Description |
|---|
GoogleMTv2Connector() |
GoogleMTv2Connector(GoogleMTAPI api) |
| Modifier and Type | Method and Description |
|---|---|
protected <T> List<List<QueryResult>> |
_batchQuery(List<String> texts,
List<T> originalTexts,
net.sf.okapi.connectors.google.QueryResultBuilder<T> qrBuilder) |
protected <T> int |
_query(String queryText,
T originalText,
net.sf.okapi.connectors.google.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.
|
protected LocaleId |
convertGoogleLanguageCode(String lang) |
protected <T> List<TranslationResponse> |
executeQuery(GoogleQueryBuilder<T> qb,
net.sf.okapi.connectors.google.QueryResultBuilder<T> qrBuilder) |
protected <T> TranslationResponse |
executeSingleSegmentQuery(GoogleQueryBuilder<T> qb,
String sourceText) |
protected <T> List<List<QueryResult>> |
flushQuery(GoogleQueryBuilder<T> qb,
net.sf.okapi.connectors.google.QueryResultBuilder<T> qrBuilder) |
String |
getName()
Gets the name of the connector.
|
GoogleMTv2Parameters |
getParameters()
Gets the current parameters of this connector.
|
String |
getSettingsDisplay()
Gets a display representation of the current settings for this connector.
|
List<LocaleId> |
getSupportedLanguages() |
void |
leverage(ITextUnit tu)
Leverages a text unit (segmented or not) based on the current settings.
|
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 |
setParameters(IParameters params)
Sets the parameters for opening and querying this connector.
|
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, hasNext, leverageUsingBatchQuery, next, removeAttribute, setAttribute, setLanguages, setNoQueryThreshold, setRootDirectory, setWeightclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemaining, removepublic GoogleMTv2Connector()
public GoogleMTv2Connector(GoogleMTAPI api)
public void setParameters(IParameters params)
IQuerysetParameters in interface IQuerysetParameters in class BaseConnectorparams - the parameters to set.public GoogleMTv2Parameters getParameters()
IQuerygetParameters in interface IQuerygetParameters in class BaseConnectorpublic void close()
IQuerypublic String getName()
IQuerypublic String getSettingsDisplay()
IQuerypublic void open()
IQuerypublic int query(String plainText)
IQueryplainText - text to query.public int query(TextFragment frag)
IQueryfrag - The text to query.protected <T> int _query(String queryText, T originalText, net.sf.okapi.connectors.google.QueryResultBuilder<T> qrBuilder)
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 <T> List<List<QueryResult>> _batchQuery(List<String> texts, List<T> originalTexts, net.sf.okapi.connectors.google.QueryResultBuilder<T> qrBuilder)
protected <T> List<List<QueryResult>> flushQuery(GoogleQueryBuilder<T> qb, net.sf.okapi.connectors.google.QueryResultBuilder<T> qrBuilder)
protected <T> TranslationResponse executeSingleSegmentQuery(GoogleQueryBuilder<T> qb, String sourceText)
protected <T> List<TranslationResponse> executeQuery(GoogleQueryBuilder<T> qb, net.sf.okapi.connectors.google.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.protected String toInternalCode(LocaleId locale)
BaseConnectortoInternalCode in class BaseConnectorlocale - the locale identifier to convert.Copyright © 2022. All rights reserved.