Home ⌂Doc Index ◂Up ▴

eric6.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.IbmWatsonEngine

Module implementing the IBM Watson translation engine.

Global Attributes

None

Classes

IbmWatsonEngine Class implementing the translation engine for the IBM Watson Language Translator service.

Functions

None


IbmWatsonEngine

Class implementing the translation engine for the IBM Watson Language Translator service.

Derived from

TranslationEngine

Class Attributes

None

Class Methods

None

Methods

IbmWatsonEngine Constructor
__adjustLanguageCode Private method to adjust a given language code.
__getTranslationModels Private method to get the translation models supported by IBM Watson Language Translator.
__getTranslationModelsReplyFinished Private slot handling the receipt of the available translations.
engineName Public method to return the name of the engine.
getTranslation Public method to translate the given text.
hasTTS Public method indicating the Text-to-Speech capability.
supportedLanguages Public method to get the supported languages.
supportedTargetLanguages Public method to get a list of supported target languages for an original language.

Static Methods

None

IbmWatsonEngine (Constructor)

IbmWatsonEngine(plugin, parent=None)

Constructor

plugin (TranslatorPlugin)
reference to the plugin object
parent (QObject)
reference to the parent object

IbmWatsonEngine.__adjustLanguageCode

__adjustLanguageCode(code)

Private method to adjust a given language code.

code (str)
code to be adjusted
Returns:
adjusted language code
Return Type:
str

IbmWatsonEngine.__getTranslationModels

__getTranslationModels()

Private method to get the translation models supported by IBM Watson Language Translator.

IbmWatsonEngine.__getTranslationModelsReplyFinished

__getTranslationModelsReplyFinished(reply)

Private slot handling the receipt of the available translations.

reply (QNetworkReply)
reference to the network reply object

IbmWatsonEngine.engineName

engineName()

Public method to return the name of the engine.

Returns:
engine name
Return Type:
str

IbmWatsonEngine.getTranslation

getTranslation(requestObject, text, originalLanguage, translationLanguage)

Public method to translate the given text.

requestObject (TranslatorRequest)
reference to the request object
text (str)
text to be translated
originalLanguage (str)
language code of the original
translationLanguage (str)
language code of the translation
Returns:
tuple of translated text and flag indicating success
Return Type:
tuple of (str, bool)

IbmWatsonEngine.hasTTS

hasTTS()

Public method indicating the Text-to-Speech capability.

Returns:
flag indicating the Text-to-Speech capability
Return Type:
bool

IbmWatsonEngine.supportedLanguages

supportedLanguages()

Public method to get the supported languages.

Returns:
list of supported language codes
Return Type:
list of str

IbmWatsonEngine.supportedTargetLanguages

supportedTargetLanguages(original)

Public method to get a list of supported target languages for an original language.

original (str)
original language
Returns:
list of supported target languages for the given original
Return Type:
list of str
Up



Home ⌂Doc Index ◂Up ▴