Difference between revisions of "Install language data by compiling"

From Apertium
Jump to navigation Jump to search
(-get is installed by default now)
(Add make langs)
 
Line 85: Line 85:
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...
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...


==== Simple build ====
Once both monolingual packages and the pair are properly configured using <code>autogen.sh</code>, you can build everything with a single command from the pair (apertium-xxx-yyy):

<pre>
make langs
</pre>


==Install (or not)==
==Install (or not)==

Latest revision as of 17:38, 9 July 2024

En français

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[edit]

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,

  • git
  • autoconf
  • automake

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

Download the language data[edit]

To see the available 'released' language pairs, go to https://apertium.github.io/apertium-on-github/source-browser.html and see the column 'trunk'. Pairs in development are in the 'incubator'/'nursery'/'staging' columns.

e.g.

git clone https://github.com/apertium/apertium-eo-en.git

or also (and quicker):

git clone --depth 1 https://github.com/apertium/apertium-eo-en.git


To see the available 'mature' language mono dictionaries, go to git clone https://github.com/apertium/ and see the column 'languages'.

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


By script[edit]

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.

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

apertium-get

Wiki page on the script: Apertium-get


Configure, build[edit]

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[edit]

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[edit]

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[edit]

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...

Simple build[edit]

Once both monolingual packages and the pair are properly configured using autogen.sh, you can build everything with a single command from the pair (apertium-xxx-yyy):

make langs

Install (or not)[edit]

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[edit]

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


Useful links[edit]

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 Git.