To start, provision a new Language Translator service instance. Once that's done, head over to your favorite text editor, open up a new Python file, and let's get coding:
- Import the service:
from ibm_watson import LanguageTranslatorV3
- Initialize the API:
language_translator = LanguageTranslatorV3(version=“2018-05-01”,
iam_apikey=“rvE894AVGJQ_t_ZNuUoQrclWWQwvpFB0_78jr9pvtjIl”)
Of course, you will have to use your own API Key.
- We just need to translate and get our result! But let's make it a bit prettier, and create a command-line interface for it:
print("Enter a sentence in English:")
eng_sent = raw_input()
translation = language_translator.translate(
text=eng_sent, model_id="en-fr").get_result() \
["translations”][0][“translation...