Apertium on Ubuntu or Debian
Installing the not-quite-recent package (simple)
If you just want to use Apertium for translation, and don't want to develop anything, you can probably just search for, tick off and install Apertium and your favorite language pairs in Synaptic. There's a friendly Synaptic HOWTO here. This should install the required dependencies too.
If you want to contribute to Apertium or change how it runs in any way, you'll want to install from SVN. Read on below.
Installing the newest version from SVN (more complicated)
First off, install the prerequisites. Open a terminal window and type
sudo apt-get install subversion build-essential g++ pkg-config libxml2 \ libxml2-dev libxml2-utils xsltproc flex automake autoconf libtool libpcre3-dev
enter your password
Wait till the packages are downloaded and installed.
Download apertium, lttoolbox and language pairs from SVN:
svn co http://apertium.svn.sourceforge.net/svnroot/apertium/trunk apertium
Note: The above checkout will download lots of files with all the language pairs. If you have limited bandwidth or disk space (or time), please follow the Minimal installation from SVN instead.
Compile and install lttoolbox:
cd apertium cd lttoolbox/ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./autogen.sh make sudo make install sudo ldconfig
Compile and install apertium:
cd .. cd apertium/ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./autogen.sh make sudo make install sudo ldconfig
You can now compile the language pairs that you want to use. It is the same procedure for every pair, we give an example with apertium-fr-es:
cd .. cd apertium-fr-es/ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./autogen.sh make sudo make install
Try it out:
echo "J'ai deux frères" | apertium fr-es
If you edit the linguistic data, do not forget to type "make" to update, and "sudo make install" to install the updated data.
Compiling all the linguistic data
To compile all the pairs without typing each directory once you can use the following script:
list=`ls -d apertium-??-??` # list of folders with a name like apertium-xx-xx for folder in $list do cd $folder >> ../compile.txt PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./autogen.sh >> ../compile.txt make >> ../compile.txt sudo make install >> ../compile.txt cd .. done
Run the script, and go and make a cup of coffee… this could take a while.
Inside compile.txt you can see some of the results of the compilation.
‘rpl_malloc’ was not declared in this scope
If you get:
make check output apertium_destxt.o apertium_destxt.cc apertium_destxt.cc: In function ‘void* yyalloc(yy_size_t)’: apertium_destxt.cc:2017: error: ‘rpl_malloc’ was not declared in this scope apertium_destxt.cc: In function ‘void* yyrealloc(void*, yy_size_t)’: apertium_destxt.cc:2029: error: ‘rpl_realloc’ was not declared in this scope make: *** [apertium_destxt.o] Error 1 make: Leaving directory `/home/surge/Resources/apertium/apertium-3.1.0/apertium'
Then the best thing to do is comment out the lines:
configure.ac and then re-run
If you get
Warning: unsupported locale, fallback to "C""
when running a command, it means that your installation doesn't have the required locale enabled. Here is a solution for Ubuntu Try something like
//replace es_EN.UTF-8 with whichever locale is relevant to your problem.
For example, if
LANG=es_ES.utf8 /usr/local/bin/apertium-deshtml /tmp/URLMH0f38
gave you the error : 'Warning: unsupported locale, fallback to "C"'. Then you could try
also see this link for an alternate method : http://tlug.dnho.net/node/237