Using apertium to translate on the command line

About Apertium

Apertium is an open source machine translating software, i.e. open source Google Translate. The apertium documentation can be a bit daunting at first, since most of the page is aimed at people who can contribute translations and has lots of linguistic terms.

There is an old guide on how to install apertium in debian, but it is out of date and doesn't work for ubuntu. Hence this page

How to translate

In this demo, I'll show how to use it to translate from English to Catalan.

First install the packages apertium (ubuntu install link) and apertium-en-ca (ubuntu install link).

Translating is easily done on the command line using the apertium programme. Just pass the text in through stdin, and the translated data will be printed out on stdout. The first argument is the language pair.

$ echo "This is not in English" | apertium en-ca Això no és en anglès

This entry is tagged: