Package net.sf.okapi.connectors.kantan
Class KantanMTConnector
- java.lang.Object
-
- net.sf.okapi.lib.translation.BaseConnector
-
- net.sf.okapi.connectors.kantan.KantanMTConnector
-
- All Implemented Interfaces:
AutoCloseable,Iterator<QueryResult>,IQuery
@Deprecated public class KantanMTConnector extends BaseConnector
Deprecated.Note: This class has been deprecated because the API version it uses is phased out. Use KantanMTv21Connector instead. Connector for the KantanMT API. These calls depend on an authorization token and profile ID provided by the user. The profile ID specifies a particular MT engine within the KantanMT service. The engine must be started separately (through the KantanMT web interface, or via API) and is assumed to be running by this connector. As the engine initialization process takes several minutes, the connector does not perform initialization on its own in theopen()method.- See Also:
- http://docs.kantanmt.apiary.io
-
-
Constructor Summary
Constructors Constructor Description KantanMTConnector()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<List<QueryResult>>batchQuery(List<TextFragment> fragments)Deprecated.Slow default implementation using query!! Override to take advantage of servers batch APIvoidclose()Deprecated.Closes this connector.protected intgetConnectionTimeout()Deprecated.StringgetName()Deprecated.Gets the name of the connector.KantanMTConnectorParametersgetParameters()Deprecated.Gets the current parameters of this connector.protected StringgetServerURL()Deprecated.StringgetSettingsDisplay()Deprecated.Gets a display representation of the current settings for this connector.protected intgetSocketTimeout()Deprecated.booleanhasNext()Deprecated.Indicates of there is a hit available.QueryResultnext()Deprecated.Gets the next hit for the last query.voidopen()Deprecated.Opens this query engine.intquery(String plainText)Deprecated.Starts a query for a give plain text.intquery(TextFragment tf)Deprecated.Starts a query for a given text.-
Methods inherited from class net.sf.okapi.lib.translation.BaseConnector
batchLeverage, batchLeverageUsingBatchQuery, batchQueryText, clearAttributes, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, leverage, leverageUsingBatchQuery, removeAttribute, setAttribute, setLanguages, setNoQueryThreshold, setParameters, setRootDirectory, setWeight, toInternalCode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Method Detail
-
getServerURL
protected String getServerURL()
Deprecated.
-
getConnectionTimeout
protected int getConnectionTimeout()
Deprecated.
-
getSocketTimeout
protected int getSocketTimeout()
Deprecated.
-
getName
public String getName()
Deprecated.Description copied from interface:IQueryGets the name of the connector.- Returns:
- the name of the connector.
-
getSettingsDisplay
public String getSettingsDisplay()
Deprecated.Description copied from interface:IQueryGets a display representation of the current settings for this connector. This can be a display of some of the parameters for example, or some explanations about default non-modifiable settings.- Returns:
- a display representation of the current settings.
-
open
public void open()
Deprecated.Description copied from interface:IQueryOpens this query engine.
-
close
public void close()
Deprecated.Description copied from interface:IQueryCloses this connector.
-
getParameters
public KantanMTConnectorParameters getParameters()
Deprecated.Description copied from interface:IQueryGets the current parameters of this connector.- Specified by:
getParametersin interfaceIQuery- Overrides:
getParametersin classBaseConnector- Returns:
- the current parameters of this connector or null if no parameters are used.
-
query
public int query(String plainText)
Deprecated.Description copied from interface:IQueryStarts a query for a give plain text.- Parameters:
plainText- text to query.- Returns:
- The number of hits for the given query.
-
query
public int query(TextFragment tf)
Deprecated.Description copied from interface:IQueryStarts a query for a given text.- Parameters:
tf- The text to query.- Returns:
- The number of hits for the given query.
-
hasNext
public boolean hasNext()
Deprecated.Description copied from interface:IQueryIndicates of there is a hit available.- Specified by:
hasNextin interfaceIQuery- Specified by:
hasNextin interfaceIterator<QueryResult>- Overrides:
hasNextin classBaseConnector- Returns:
- True if a hit is available, false if not.
-
next
public QueryResult next()
Deprecated.Description copied from interface:IQueryGets the next hit for the last query.- Specified by:
nextin interfaceIQuery- Specified by:
nextin interfaceIterator<QueryResult>- Overrides:
nextin classBaseConnector- Returns:
- A QueryResult object that holds the source and target text of the hit, or null if there is no more hit.
-
batchQuery
public List<List<QueryResult>> batchQuery(List<TextFragment> fragments)
Deprecated.Description copied from class:BaseConnectorSlow default implementation using query!! Override to take advantage of servers batch API- Specified by:
batchQueryin interfaceIQuery- Overrides:
batchQueryin classBaseConnector- Parameters:
fragments- list of the text fragments to translate.- Returns:
- a list of lists of query result. Each list corresponds to a source text (in the same order)
-
-