19.2 aztranslate quick start

20210524 Let’s quickly explore some examples to show off the various commands supported by the package.

A simple translate takes a sentence on the command line. The language is automatically detected and the resulting translation is to English by default (see the translate command for details):

$ ml translate aztranslate Selamat pagi
ms,1.0,en,good morning

The target language can be specified using -t or --to= with a country code. Suppose we want to translate to French (fr):

$ ml translate aztranslate --to=fr Selamat pagi
ms,1.0,fr,Bonjour

Many languages are supported, including Persian (i.e., Fairsi or fa):

$ ml translate aztranslate --to=fa Please direct me to the restaurant
en,1.0,fa,لطفا مرا به رستوران هدایت کنید

You can list the supported languages:

$ ml supported aztranslate
af,ltr,Afrikaans,Afrikaans
am,ltr,Amharic,አማርኛ
ar,rtl,Arabic,العربية
...
zh-Hans,ltr,Chinese Simplified,简体中文
zh-Hant,ltr,Chinese Traditional,繁體中文

The translation can be saved to file:

$ ml translate aztranslate --to fr Good morning | cut -d, -f4- > greeting_fr.txt
$ ml translate aztranslate --input greeting_fr.txt
fr,1.0,en,Hello

Pipelines work great:

$ cat greeting_fr.txt | ml translate aztranslate
fr,1.0,en,Hello

$ ml transcribe azspeech | ml translate aztranslate --to fr
en,1.0,fr,AI est assez bon à la traduction de nos jours.

But there are limits to the current state of the art in translation (see the limits command for details):

$ ml limits aztranslate
===========================
Limitations of Translations
===========================

Douglas Hofstadter, a professor of cognitive science and comparative
...


Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.