Package net.sf.okapi.connectors.deepl
Class DeepLv1Connector
- java.lang.Object
-
- net.sf.okapi.lib.translation.BaseConnector
-
- net.sf.okapi.connectors.deepl.DeepLv1Connector
-
- All Implemented Interfaces:
AutoCloseable,Iterator<QueryResult>,IQuery
public class DeepLv1Connector extends BaseConnector
MT connector for DeepL. See https://www.deepl.com/docs/api-reference.html for details.
-
-
Constructor Summary
Constructors Modifier Constructor Description DeepLv1Connector()protectedDeepLv1Connector(org.apache.http.impl.client.CloseableHttpClient httpClient)Constructor for tests
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<List<QueryResult>>batchQuery(List<TextFragment> originalFragmentList)voidclose()List<List<TextFragment>>getFragmentGroups()intgetMaxRequestSize()intgetMaxTextParameters()StringgetName()DeepLv1ConnectorParametersgetParameters()StringgetSettingsDisplay()booleanhasNext()QueryResultnext()voidopen()intquery(String text)intquery(TextFragment fragment)protected StringremoveDupeCodes(String dupeCodeText)voidsetMaxRequestSize(int maxRequestSize)Used for 'batchQuery' mode, sets a value (bytes) to use when grouping text fragments.voidsetMaxTextParameters(int maxTextParameters)voidsetParameters(IParameters params)protected StringtoInternalCode(LocaleId locale)-
Methods inherited from class net.sf.okapi.lib.translation.BaseConnector
batchLeverage, batchLeverageUsingBatchQuery, batchQueryText, clearAttributes, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, leverage, leverageUsingBatchQuery, removeAttribute, setAttribute, setLanguages, setNoQueryThreshold, setRootDirectory, setWeight
-
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
-
getMaxRequestSize
public int getMaxRequestSize()
-
setMaxRequestSize
public void setMaxRequestSize(int maxRequestSize)
Used for 'batchQuery' mode, sets a value (bytes) to use when grouping text fragments. For each request made to DeepL, the total size of the group of text fragments will not exceed this size.- Parameters:
maxRequestSize- the maximum size in bytes to use for each DeepL request (otherwise default is 28KB)
-
getMaxTextParameters
public int getMaxTextParameters()
-
setMaxTextParameters
public void setMaxTextParameters(int maxTextParameters)
-
getFragmentGroups
public List<List<TextFragment>> getFragmentGroups()
-
close
public void close()
-
getName
public String getName()
-
getSettingsDisplay
public String getSettingsDisplay()
-
getParameters
public DeepLv1ConnectorParameters getParameters()
- Specified by:
getParametersin interfaceIQuery- Overrides:
getParametersin classBaseConnector
-
setParameters
public void setParameters(IParameters params)
- Specified by:
setParametersin interfaceIQuery- Overrides:
setParametersin classBaseConnector
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceIQuery- Specified by:
hasNextin interfaceIterator<QueryResult>- Overrides:
hasNextin classBaseConnector
-
next
public QueryResult next()
- Specified by:
nextin interfaceIQuery- Specified by:
nextin interfaceIterator<QueryResult>- Overrides:
nextin classBaseConnector
-
batchQuery
public List<List<QueryResult>> batchQuery(List<TextFragment> originalFragmentList)
- Specified by:
batchQueryin interfaceIQuery- Overrides:
batchQueryin classBaseConnector
-
query
public int query(String text)
-
query
public int query(TextFragment fragment)
-
toInternalCode
protected String toInternalCode(LocaleId locale)
- Overrides:
toInternalCodein classBaseConnector
-
open
public void open()
-
-