Install language data by compiling

From Apertium
Revision as of 15:04, 27 April 2017 by Rcrowther (talk | contribs)
Jump to navigation Jump to search

To start a new language pair, goto How to bootstrap a new pair. The instructions are very different. This page is for existing language data.


Prerequisites

If you compiled Apertium core, then you are likely to have everything you need to compile a dictionary or pair. A compile of a pair can fail if it needs a Constraint Grammar or HFST. If that happens, follow instructions under missing dependencies.

If you loaded Apertium core from packages, either from the Apertium or a public repository, then you will need compile tools. For a dictionary or pair, you will not need all the library installs needed for a full compile of Apertium. In operating systems/distros with a minimal build environment, you may only need,

  • subversion (SVN)
  • autoconf
  • automake

For a fuller list, see *nix (in general) or the instructions on individual operating systems.

Download the language data

To see the available 'released' language pairs, go to https://svn.code.sf.net/p/apertium/svn/trunk/. Pairs in development are in the incubator/nursery/staging subdirectories of https://svn.code.sf.net/p/apertium/svn/.

e.g.

svn checkout https://svn.code.sf.net/p/apertium/svn/trunk/apertium-eo-en

To see the available 'mature' language mono dictionaries, go to https://svn.code.sf.net/p/apertium/svn/languages/.

  • Note: please make sure that the directory where you put these files (i.e. where you run the svn command) doesn't contain spaces and other special characters. That may cause errors while compiling/linking.


By script

If you've already got the core tools installed and you download Apertium languages frequently, then there's a script that can download and setup a language data (pair + possible dependencies) for you. The script can look in trunk, staging, nursery, and incubator.

Please consider that the script can not download a mono-dictionary.

If you installed the apertium-all-dev package, you already have the script running from the commandline,

apertium-get

To get the script and release execution permission, go to the directory where you want your Apertium data to be, and run,

wget https://raw.githubusercontent.com/unhammer/apertium-get/master/apertium-get
chmod +x apertium-get

The apertium-get script is sophisticated enough to offer help,

./apertium-get -h

Wiki page on the script: Apertium-get


Configure, build

Go into the downloaded directiory and do this,

./autogen.sh
make

If a language pair has more dependencies than lt-toolbox and apertium-lex-tools (i.e. the core), the README should mention it (and the autogen.sh step should fail with a message about what is missing). The top of this page has links to how to install other dependencies.

Some possible problems,

Missing dependencies

Some language pairs need code libraries which are not part of Apertium core/lt-tools. You may not know until a compile starts streaming 'fail' messages. If your language pair complains about lacking 'CG3' or 'HFST', you need to install support libraries. See Installation of grammar libraries.

Missing language data

If your pair complains about lacking language data like apertium-rus, the pair is missing a dictionary. This is happening more nowadays because language pairs are sharing dictionaries. Sharing dictionaries shares effort. If you used the download script above, this will probably not happen. The README should have explained that the pair shares a dictionary. Or maybe you start autogen.sh then find it fails with a message like,

No package 'apertium-yyy' found

(where yyy is some language code).

If this happens you must treat the missing language as part of a new pair. You can find full instructions at How to bootstrap a new pair. In short, download the missing monodix and place it in the download with the missing language. autogen.sh then make both monodix folders then, in the bidex folder, run the binding configuration, then make,

cd apertium-xxx-yyy
./autogen.sh --with-lang1=../apertium-xxx --with-lang2=../apertium-yyy
make

Reminder: Adjust prefixes

In some rare circumstances, an Apertium core is hand-compiled then placed at a custom prefix. The reasons you chose to do that may mean you need also to install language data at a custom prefix. In which case, we assume you know what you are doing...


Install (or not)

Note: Developers should be careful. Many new/incubator language pairs don't work if installed :-)

If you are developing the language data, do not install. You may confuse results between a development and an installed pair. However, in the rare situation that you are a user who wants to translate only, yet ran a compile, you can install. This should be done from the bidex directory,

 cd xxx-yyy
 make install


Test

When they work, Install quick tests make the world seem better.


Useful links

For those who are new here, or need a reminder, Install How to use a build.

If you have not used Apertium before, try Modes introduction and Monodix basics.

To start work on the new translation pair, Apertium New Language Pair HOWTO.

If you have made changes and/or improvements to a pair, please see Contributing to an existing pair. You may even get to Using SVN.