Package net.sf.okapi.connectors.google
Class GoogleMTAPIImpl
- java.lang.Object
-
- net.sf.okapi.connectors.google.GoogleMTAPIImpl
-
- All Implemented Interfaces:
GoogleMTAPI
public class GoogleMTAPIImpl extends Object implements GoogleMTAPI
-
-
Constructor Summary
Constructors Constructor Description GoogleMTAPIImpl(String baseUrl, GoogleMTv2Parameters params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>getLanguages()<T> List<TranslationResponse>translate(GoogleQueryBuilder<T> qb)Make a single call to Google to translate the provided list of source texts.<T> TranslationResponsetranslateSingleSegment(GoogleQueryBuilder<T> qb, String sourceText)Perform translation of oversized (> 2048 characters) segments.
-
-
-
Constructor Detail
-
GoogleMTAPIImpl
public GoogleMTAPIImpl(String baseUrl, GoogleMTv2Parameters params)
-
-
Method Detail
-
getLanguages
public List<String> getLanguages() throws IOException, org.json.simple.parser.ParseException
- Specified by:
getLanguagesin interfaceGoogleMTAPI- Throws:
IOExceptionorg.json.simple.parser.ParseException
-
translate
public <T> List<TranslationResponse> translate(GoogleQueryBuilder<T> qb) throws IOException, org.json.simple.parser.ParseException
Description copied from interface:GoogleMTAPIMake a single call to Google to translate the provided list of source texts. The source texts must obey Google protocol limits of <= 2048 total characters per request.- Specified by:
translatein interfaceGoogleMTAPI- Throws:
IOExceptionorg.json.simple.parser.ParseException
-
translateSingleSegment
public <T> TranslationResponse translateSingleSegment(GoogleQueryBuilder<T> qb, String sourceText) throws IOException, org.json.simple.parser.ParseException
Description copied from interface:GoogleMTAPIPerform translation of oversized (> 2048 characters) segments.- Specified by:
translateSingleSegmentin interfaceGoogleMTAPI- Returns:
- the translation response
- Throws:
IOExceptionorg.json.simple.parser.ParseException
-
-