watson_developer_cloud.language_translator_v2 module

— Language Translator v3 is [available](https://www.ibm.com/watson/developercloud/language-translator/api/v3/). See the [migration guide](https://console.bluemix.net/docs/services/language-translator/migrating.html). — IBM Watson™ Language Translator translates text from one language to another. The service offers multiple domain-specific 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.

class LanguageTranslatorV2(url='https://gateway.watsonplatform.net/language-translator/api', username=None, password=None, iam_api_key=None, iam_access_token=None, iam_url=None)[source]

Bases: watson_developer_cloud.watson_service.WatsonService

The Language Translator V2 service.

default_url = 'https://gateway.watsonplatform.net/language-translator/api'
translate(**kwargs)
identify(**kwargs)
list_identifiable_languages(**kwargs)
create_model(**kwargs)
delete_model(**kwargs)
get_model(**kwargs)
list_models(**kwargs)
class DeleteModelResult(status)[source]

Bases: object

DeleteModelResult.

Attr str status:
 “OK” indicates that the model was successfully deleted.
class IdentifiableLanguage(language, name)[source]

Bases: object

IdentifiableLanguage.

Attr str language:
 The language code for an identifiable language.
Attr str name:The name of the identifiable language.
class IdentifiableLanguages(languages)[source]

Bases: object

IdentifiableLanguages.

Attr list[IdentifiableLanguage] languages:
 A list of all languages that the service

can identify.

class IdentifiedLanguage(language, confidence)[source]

Bases: object

IdentifiedLanguage.

Attr str language:
 The language code for an identified language.
Attr float confidence:
 The confidence score for the identified language.
class IdentifiedLanguages(languages)[source]

Bases: object

IdentifiedLanguages.

Attr list[IdentifiedLanguage] languages:
 A ranking of identified languages with

confidence scores.

class Translation(translation_output)[source]

Bases: object

Translation.

Attr str translation_output:
 Translation output in UTF-8.
class TranslationModel(model_id, name=None, source=None, target=None, base_model_id=None, domain=None, customizable=None, default_model=None, owner=None, status=None)[source]

Bases: object

Response payload for models.

Attr str model_id:
 A globally unique string that identifies the underlying model that

is used for translation. :attr str name: (optional) Optional name that can be specified when the model is created. :attr str source: (optional) Translation source language code. :attr str target: (optional) Translation target language code. :attr str base_model_id: (optional) Model ID of the base model that was used to customize the model. If the model is not a custom model, this will be an empty string. :attr str domain: (optional) The domain of the translation model. :attr bool customizable: (optional) Whether this model can be used as a base for customization. Customized models are not further customizable, and some base models are not customizable. :attr bool default_model: (optional) Whether or not the model is a default model. A default model is the model for a given language pair that will be used when that language pair is specified in the source and target parameters. :attr str owner: (optional) Either an empty string, indicating the model is not a custom model, or the ID of the service instance that created the model. :attr str status: (optional) Availability of a model.

class TranslationModels(models)[source]

Bases: object

The response type for listing existing translation models.

Attr list[TranslationModel] models:
 An array of available models.
class TranslationResult(word_count, character_count, translations)[source]

Bases: object

TranslationResult.

Attr int word_count:
 Number of words in the input text.
Attr int character_count:
 Number of characters in the input text.
Attr list[Translation] translations:
 List of translation output in UTF-8,

corresponding to the input text entries.