Difference between revisions of "Apertium on openSUSE"

From Apertium
Jump to navigation Jump to search
Line 68: Line 68:
 
=== Install ''apertium'' ===
 
=== Install ''apertium'' ===
   
At the end, you will get a message about ''PKG_CONFIG_PATH'', so we will set it as part of the configure process.
+
At the end, you will get a message about ''PKG_CONFIG_PATH'', so we will set it as part of the configure process. We will also set up a library path to ensure Apertium can find the ''lttoolbox'' libraries we just built.
   
 
From ''[homedir]'':
 
From ''[homedir]'':
Line 74: Line 74:
 
<pre>
 
<pre>
 
cd apertium/trunk/apertium
 
cd apertium/trunk/apertium
  +
export LD_LIBRARY_PATH=[homedir]/local/lib
./autogen.sh
 
PKG_CONFIG_PATH=[homedir]/local/lib/pkgconfig ./configure --prefix=[homedir]/local
+
./autogen.sh PKG_CONFIG_PATH=[homedir]/local/lib/pkgconfig ./configure --prefix=[homedir]/local
 
make
 
make
 
make install
 
make install
Line 100: Line 100:
 
<pre>
 
<pre>
 
cd apertium/trunk/apertium-cy-en
 
cd apertium/trunk/apertium-cy-en
  +
export LD_LIBRARY_PATH=[homedir]/local/lib
./autogen.sh
 
PKG_CONFIG_PATH=[homedir]/local/lib/pkgconfig ./configure --prefix=[homedir]/local
+
./autogen.sh PKG_CONFIG_PATH=[homedir]/local/lib/pkgconfig ./configure --prefix=[homedir]/local
 
make
 
make
 
make install
 
make install
 
</pre>
 
</pre>
   
Your ''[homedir]/local/share/apertium'' should now contain a new folder ''apertium-cy-en'', and the ''modes'' folder should contain a file for each language direction (''cy-en'' and ''en-cy'').
+
Your ''[homedir]/local/share/apertium'' should now contain a new folder ''apertium-cy-en'', and the ''modes'' folder should contain a file for the Welsh-English language direction (''cy-en.mode'').
   
 
Note that if you are using an AMD64 processor, you must use version 3.0.4 or above of Apertium. Versions below this have a bug which will mean the make fails.
 
Note that if you are using an AMD64 processor, you must use version 3.0.4 or above of Apertium. Versions below this have a bug which will mean the make fails.
Line 113: Line 113:
   
 
From ''[homedir]'':
 
From ''[homedir]'':
 
<pre>
 
echo "test" | apertium en-cy
 
</pre>
 
 
You should see ''prawf'' returned.
 
   
 
<pre>
 
<pre>
Line 124: Line 118:
 
</pre>
 
</pre>
   
You should see ''test'' returned.
+
You should see ''test'' returned. Currently there is no English-Welsh direction.
   
 
[[Category:Documentation]]
 
[[Category:Documentation]]

Revision as of 14:26, 3 March 2009

Introduction

This note explains how to install the latest 3.0.4 svn version of Apertium on a stock openSUSE 10.2. Apertium is installed here into a directory in the user's homedir - in my case it was /home/kevin/downloads/linguistics, but it can be anything you choose. In this note, this choice will be referred to as [homedir].

Install required packages

If you choose the development pattern at or after your openSUSE install (using YaST, Smart, zypper or whatever), you will get most of the packages required for development, and may not have to add all of those listed below. Ensure that the following packages are present:

  • subversion
  • libxml2 and libxml2-devel
  • libxslt
  • libtool
  • pcre and pcre-devel
  • flex
  • automake
  • autoconf
  • gcc-c++

Download Apertium

Open a terminal, go to your [homedir] and checkout the latest version:

cd [homedir]
svn co https://apertium.svn.sourceforge.net/svnroot/apertium

This will take some time to fully download, and at the end you should have a directory [homedir]/apertium with 43 folders in it, some containing tools and some containing language-pair data.

If you want to download only the bare essentials to build the (eg) Welsh translator, the commands would be:

cd [homedir]
svn co https://apertium.svn.sourceforge.net/svnroot/apertium/trunk/apertium
svn co https://apertium.svn.sourceforge.net/svnroot/apertium/trunk/apertium-cy-en
svn co https://apertium.svn.sourceforge.net/svnroot/apertium/trunk/lttoolbox

Set up your install dirs

From [homedir]:

mkdir local

Install lttoolbox

From [homedir]:

cd apertium/trunk/lttoolbox
./autogen.sh

Obviously, replace [homedir] here and in subsequent instances by your real path.

Set the local dir as part of the configure process:

./configure --prefix=[homedir]/local
make
make install

Your [homedir]/local dir should now contain four folders: bin, include, lib, and share.

Install apertium

At the end, you will get a message about PKG_CONFIG_PATH, so we will set it as part of the configure process. We will also set up a library path to ensure Apertium can find the lttoolbox libraries we just built.

From [homedir]:

cd apertium/trunk/apertium
export LD_LIBRARY_PATH=[homedir]/local/lib
./autogen.sh PKG_CONFIG_PATH=[homedir]/local/lib/pkgconfig ./configure --prefix=[homedir]/local
make
make install

Your [homedir]/local/bin dir should now contain a number of apertium binaries.

Install VISL CG3

Apertium for Welsh now requires this constraint grammar package to help with disambiguation. For install instructions go here.

Install language-pair data

In this instance we will install the cy-en (Welsh-English) pair. First, we need to ensure that the system can find the new Apertium binaries:

export PATH=/[homedir]/local/bin:$PATH

(This can be made permanent later, by adding the path to ~/.bash_profile, or whatever is your preferred method for doing this.)

From [homedir]:

cd apertium/trunk/apertium-cy-en
export LD_LIBRARY_PATH=[homedir]/local/lib
./autogen.sh PKG_CONFIG_PATH=[homedir]/local/lib/pkgconfig ./configure --prefix=[homedir]/local
make
make install

Your [homedir]/local/share/apertium should now contain a new folder apertium-cy-en, and the modes folder should contain a file for the Welsh-English language direction (cy-en.mode).

Note that if you are using an AMD64 processor, you must use version 3.0.4 or above of Apertium. Versions below this have a bug which will mean the make fails.

Testing the new install

From [homedir]:

echo "prawf" | apertium cy-en

You should see test returned. Currently there is no English-Welsh direction.