Class GoogleQueryBuilder<T>
- java.lang.Object
-
- net.sf.okapi.connectors.google.v3.GoogleQueryBuilder<T>
-
- Type Parameters:
T- the type of original source content (String or TextFragment)
public class GoogleQueryBuilder<T> extends Object
Builder for Google Cloud Translation API v3 queries. Manages batching of translation requests.
-
-
Constructor Summary
Constructors Constructor Description GoogleQueryBuilder(String sourceLanguage, String targetLanguage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddQuery(String queryText, T originalSource)Add a query to the batch.List<String>getQueries()StringgetQuery()intgetSourceCount()StringgetSourceLanguage()List<T>getSources()StringgetTargetLanguage()booleanhasCapacity(String text)Check if there is capacity to add the given text.voidreset()Reset the builder for a new batch.
-
-
-
Method Detail
-
addQuery
public void addQuery(String queryText, T originalSource)
Add a query to the batch. * @param queryText the text to translate- Parameters:
originalSource- the original source object
-
hasCapacity
public boolean hasCapacity(String text)
Check if there is capacity to add the given text. * @param text the text to check- Returns:
- true if the text can be added without exceeding limits
-
reset
public void reset()
Reset the builder for a new batch.
-
getSourceLanguage
public String getSourceLanguage()
-
getTargetLanguage
public String getTargetLanguage()
-
getSourceCount
public int getSourceCount()
-
getQuery
public String getQuery()
-
-