public class TranslateToolkitTMConnector extends BaseConnector implements ITMQuery
IQuery for the amaGama TM hosted for Translate-Toolkit.
Initial URL was: http://amagama.locamotion.org:80/tmserver/
Around May-20-2014 it changed to: https://amagama-live.translatehouse.org/api/v1/
| Constructor and Description |
|---|
TranslateToolkitTMConnector() |
| Modifier and Type | Method and Description |
|---|---|
List<List<QueryResult>> |
batchQuery(List<TextFragment> fragments)
Slow default implementation using query!!
Override to take advantage of servers batch API
|
void |
clearAttributes()
Removes all attributes from this query engine.
|
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.
|
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 |
setMaximumHits(int max)
Sets the maximum number of hits to retrieve.
|
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 |
setThreshold(int threshold)
Sets the threshold value to use for the query.
|
protected String |
toInternalCode(LocaleId standardCode)
Converts a locale identifier to the internal string value for a language/locale code for this connector.
|
batchLeverage, batchLeverageUsingBatchQuery, batchQueryText, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, leverage, leverageUsingBatchQuery, setLanguages, setNoQueryThreshold, setWeightclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbatchLeverage, batchQueryText, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, leverage, setLanguages, setNoQueryThreshold, setWeightforEachRemaining, removepublic String getName()
IQuerypublic String getSettingsDisplay()
IQuerygetSettingsDisplay in interface IQuerypublic void close()
IQueryclose in interface AutoCloseableclose in interface IQuerypublic 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 void open()
IQuerypublic int query(String plainText)
IQuerypublic int query(TextFragment text)
IQuerypublic List<List<QueryResult>> batchQuery(List<TextFragment> fragments)
BaseConnectorbatchQuery in interface IQuerybatchQuery in class BaseConnectorfragments - list of the text fragments to translate.public void clearAttributes()
IQueryclearAttributes in interface IQueryclearAttributes in class BaseConnectorpublic void removeAttribute(String name)
IQueryremoveAttribute in interface IQueryremoveAttribute in class BaseConnectorname - The name of the attribute to remove.public void setAttribute(String name, String value)
IQuerysetAttribute in interface IQuerysetAttribute in class BaseConnectorname - name of the attribute.value - Value of the attribute.public void setMaximumHits(int max)
ITMQuerysetMaximumHits in interface ITMQuerymax - The maximum number of hits to retrieve.public void setThreshold(int threshold)
ITMQuerysetThreshold in interface ITMQuerythreshold - The threshold value (between 0 and 100).public int getMaximumHits()
ITMQuerygetMaximumHits in interface ITMQuerypublic int getThreshold()
ITMQuerygetThreshold in interface ITMQueryprotected String toInternalCode(LocaleId standardCode)
BaseConnectortoInternalCode in class BaseConnectorstandardCode - 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 void setRootDirectory(String rootDir)
IQuerysetRootDirectory in interface IQuerysetRootDirectory in class BaseConnectorrootDir - the root directory.Copyright © 2021. All rights reserved.