Class ZCL_IBMC_LANG_TRANSLATOR_V3
public inheriting from zcl_ibmc_service_ext create public
Documentation
Language Translator
IBM Watson™ Language Translator translates text from one language to another. The service offers multiple IBM-provided translation models that you can customize based on your unique terminology and language. Use Language Translator to take news from across the globe and present it in your language, communicate with your customers in their own language, and more.Types
Visibility and Level | Name | Documentation |
---|---|---|
public | t_base_model_id type string | Model ID of the base model that was used to customize the model. If the model is not a custom model, this will be absent or an empty string. |
public | t_delete_model_result (structured type) | No documentation available. |
public | t_document_id type string | System generated ID identifying a document being translated using one specific translation model. |
public | t_document_list (structured type) | No documentation available. |
public | t_document_status (structured type) | Document information, including translation status. |
public | t_error_response (structured type) | No documentation available. |
public | t_get_translated_doc_response type file | No documentation available. |
public | t_identifiable_language (structured type) | No documentation available. |
public | t_identifiable_languages (structured type) | No documentation available. |
public | t_identified_language (structured type) | No documentation available. |
public | t_identified_languages (structured type) | No documentation available. |
public | t_inline_object (structured type) | No documentation available. |
public | t_inline_object1 (structured type) | No documentation available. |
public | t_language (structured type) | Response payload for languages. |
public | t_languages (structured type) | The response type for listing supported languages. |
public | t_model_id type string | A globally unique string that identifies the underlying model that is used for translation. |
public | t_source type string | Translation source language code. |
public | t_target type string | Translation target language code. |
public | t_translate_request (structured type) | No documentation available. |
public | t_translation (structured type) | No documentation available. |
public | t_translation_model (structured type) | Response payload for models. |
public | t_translation_models (structured type) | The response type for listing existing translation models. |
public | t_translation_result (structured type) | No documentation available. |
public | t_translation_status type string | The status of the translation job associated with a submitted document. |
Constants
Visibility and Level | Name | Documentation |
---|---|---|
public static | c_abapname_dictionary (structured type) | Map ABAP identifiers to service identifiers. |
public static | c_required_fields (structured type) | List of required fields per type. |
Methods
Visibility and Level | Name | Documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public instance |
| Create model Uploads training files to customize a translation model. You can customize a model with a forced glossary or with a parallel corpus:* Use a *forced glossary* to force certain terms and phrases to be translated in a specific way. You can upload only a single forced glossary file for a model. The size of a forced glossary file for a custom model is limited to 10 MB. * Use a *parallel corpus* when you want your custom model to learn from general translation patterns in parallel sentences in your samples. What your model learns from a parallel corpus can improve translation results for input text that the model has not been trained on. You can upload multiple parallel corpora files with a request. To successfully train with parallel corpora, the corpora files must contain a cumulative total of at least 5000 parallel sentences. The cumulative size of all uploaded corpus files for a custom model is limited to 250 MB. Depending on the type of customization and the size of the uploaded files, training time can range from minutes for a glossary to several hours for a large parallel corpus. To create a model that is customized with a parallel corpus and a forced glossary, customize the model with a parallel corpus first and then customize the resulting model with a forced glossary. You can create a maximum of 10 custom models per language pair. For more information about customizing a translation model, including the formatting and character restrictions for data files, see [Customizing your model](https://cloud.ibm.com/docs/language-translator?topic=language-translator -customizing). #### Supported file formats You can provide your training data for customization in the following document formats: * **TMX** (`.tmx`) - Translation Memory eXchange (TMX) is an XML specification for the exchange of translation memories. * **XLIFF** (`.xliff`) - XML Localization Interchange File Format (XLIFF) is an XML specification for the exchange of translation memories. * **CSV** (`.csv`) - Comma-separated values (CSV) file with two columns for aligned sentences and phrases. The first row must have two language codes. The first column is for the source language code, and the second column is for the target language code. * **TSV** (`.tsv` or `.tab`) - Tab-separated values (TSV) file with two columns for aligned sentences and phrases. The first row must have two language codes. The first column is for the source language code, and the second column is for the target language code. * **JSON** (`.json`) - Custom JSON format for specifying aligned sentences and phrases. * **Microsoft Excel** (`.xls` or `.xlsx`) - Excel file with the first two columns for aligned sentences and phrases. The first row contains the language code. You must encode all text data in UTF-8 format. For more information, see [Supported document formats for training data](https://cloud.ibm.com/docs/language-translator?topic=language-translator- customizing#supported-document-formats-for-training-data). #### Specifying file formats You can indicate the format of a file by including the file extension with the file name. Use the file extensions shown in **Supported file formats**. Alternatively, you can omit the file extension and specify one of the following `content-type` specifications for the file: * **TMX** - `application/x-tmx+xml` * **XLIFF** - `application/xliff+xml` * **CSV** - `text/csv` * **TSV** - `text/tab-separated-values` * **JSON** - `application/json` * **Microsoft Excel** - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` For example, with `curl`, use the following `content-type` specification to indicate the format of a CSV file named **glossary**: `--form "forced_glossary=@glossary;type=text/csv"` Parameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| Delete document Deletes a documentParameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| Delete model Deletes a custom translation model.Parameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance | get_appname redefinition | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| Get document status Gets the translation status of a documentParameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| Get model details Gets information about a translation model, including training status for custom models. Use this method to poll the status of your customization request. A successfully completed training request has a status of `available`.Parameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance | get_request_prop redefinition | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance | get_sdk_version_date redefinition | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| Get translated document Gets the translated document associated with the given document IDParameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| Identify language Identifies the language of the input text.Parameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| List documents Lists documents that have been submitted for translationParameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| List identifiable languages Lists the languages that the service can identify. Returns the language code (for example, `en` for English or `es` for Spanish) and name of each language.Parameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| List supported languages Lists all supported languages for translation. The method returns an array of supported languages with information about each language. Languages are listed in alphabetical order by language code (for example, `af`, `ar`). In addition to basic information about each language, the response indicates whether the language is `supported_as_source` for translation and `supported_as_target` for translation. It also lists whether the language is `identifiable`.Parameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| List models Lists available translation models.Parameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| Translate Translates the input text from the source language to the target language. Specify a model ID that indicates the source and target languages, or specify the source and target languages individually. You can omit the source language to have the service attempt to detect the language from the input text. If you omit the source language, the request must contain sufficient input text for the service to identify the source language.You can translate a maximum of 50 KB (51,200 bytes) of text with a single request. All input text must be encoded in UTF-8 format. Parameters
Class-based Exceptions
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
public instance |
| Translate document Submit a document for translation. You can submit the document contents in the `file` parameter, or you can specify a previously submitted document by document ID. The maximum file size for document translation is* **2 MB** for service instances on the Lite plan * **20 MB** for service instances on the Standard plan * **50 MB** for service instances on the Advanced plan * **150 MB** for service instances on the Premium plan You can specify the format of the file to be translated in one of two ways: * By specifying the appropriate file extension for the format. * By specifying the content type (MIME type) of the format as the `type` of the `file` parameter. In some cases, especially for subtitle file formats, you must use either the file extension or the content type. For more information about all supported file formats, their file extensions and content types, and how and when to specify the file extension or content type, see [Supported file formats](https://cloud.ibm.com/docs/language-translator?topic=language-translat or-document-translator-tutorial#supported-file-formats). **Note:** When translating a previously submitted document, the target language must be different from the target language of the original request when the document was initially submitted. Parameters
Class-based Exceptions
|