Difference between revisions of "How to bootstrap a new pair"

From Apertium
Jump to navigation Jump to search
(update download link for -init)
(16 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
{{TOCD}}
 
{{TOCD}}
  +
How to use apertium-init to bootstrap a new language pair (optionally with new monolingual data packages as well).
   
 
==Prerequisites==
 
==Prerequisites==
Line 5: Line 6:
 
''You need to get this installed first:''
 
''You need to get this installed first:''
   
  +
* apertium/lttoolbox/hfst, see [[Installation]], in particular the ''prerequisites'' parts. (You most likely don't need to go all the way, since you should get this stuff from Tino's repositories. If you're on Windows, get the [[Apertium VirtualBox]].)
* [[apertium-init]]
 
  +
* [[apertium-init]].py – put this script in your working directory where you will be downloading language data (you only need https://apertium.projectjj.com/apt/nightly/apertium-init – not the whole repository –, although the information in the [https://github.com/apertium/apertium-init/blob/master/README.md README.md] file may be useful for troubleshooting)
* apertium/lttoolbox/hfst, see [[Installation]], in particular the ''prerequisites'' parts. (You most likely don't need to go all the way to "minimal instlalation from svn", since you should get this stuff from Tino's repositories. If you're on Windows, get the virtualbox)
 
   
 
==With two existing monolingual packages==
 
==With two existing monolingual packages==
   
Do the two languagues you're making a pair of already have monolingual modules in https://svn.code.sf.net/p/apertium/svn/languages/ (or perhaps https://svn.code.sf.net/p/apertium/svn/incubator )?
+
Do the two languages you're making a pair of already have monolingual modules in [https://apertium.github.io/apertium-on-github/source-browser.html the repository]?
   
Then follow this part, replacing LANG1 and LANG2 for the ISO 639-3 codes of your languages:
+
Then follow this part, replacing XXX and YYY for the ISO 639-3 codes of your languages:
   
   
 
First compile the monolingual packages:
 
First compile the monolingual packages:
 
<pre>
 
<pre>
svn co https://svn.code.sf.net/p/apertium/svn/languages/apertium-LANG1
+
git clone https://github.com/apertium/apertium-XXX.git
cd apertium-LANG1
+
cd apertium-XXX
 
./autogen.sh
 
./autogen.sh
 
make -j
 
make -j
 
cd ..
 
cd ..
svn co https://svn.code.sf.net/p/apertium/svn/languages/apertium-LANG2
+
git clone https://github.com/apertium/apertium-YYY.git
cd apertium-LANG2
+
cd apertium-YYY
 
./autogen.sh
 
./autogen.sh
 
make -j
 
make -j
Line 31: Line 32:
 
Then generate the pair:
 
Then generate the pair:
 
<pre>
 
<pre>
python3 apertium-init.py LANG1-LANG2
+
python3 apertium-init.py XXX-YYY
 
</pre>
 
</pre>
   
Line 37: Line 38:
   
 
<pre>
 
<pre>
./autogen.sh --with-lang1=../apertium-LANG1 --with-lang2=../apertium-LANG2
+
./autogen.sh --with-lang1=../apertium-XXX --with-lang2=../apertium-YYY
 
make -j
 
make -j
 
</pre>
 
</pre>
Line 43: Line 44:
 
And test:
 
And test:
 
<pre>
 
<pre>
echo house | apertium -d . LANG1-LANG2
+
echo house | apertium -d . XXX-YYY
echo Haus | apertium -d . LANG2-LANG1
+
echo Haus | apertium -d . YYY-XXX
 
</pre>
 
</pre>
   
Now you can add words to apertium-LANG1-LANG2.LANG1-LANG2.dix, then test again:
+
Now you can add words to apertium-XXX-YYY.XXX-YYY.dix, then test again:
   
 
<pre>
 
<pre>
 
make -j
 
make -j
echo house | apertium -d . LANG1-LANG2
+
echo house | apertium -d . XXX-YYY
echo Haus | apertium -d . LANG2-LANG1
+
echo Haus | apertium -d . YYY-XXX
 
</pre>
 
</pre>
   
Line 59: Line 60:
 
==With one existing monolingual package==
 
==With one existing monolingual package==
   
  +
Does just one of the two languagues you're making a pair of already have a monolingual module in [https://apertium.github.io/apertium-on-github/source-browser.html the repository]?
First make a new monolingual package:
 
  +
   
  +
Then follow this part, replacing XXX and YYY for the ISO 639-3 codes of your languages; here we assume XXX needs to be made from scratch. <br>
Then compile the monolingual packages:
 
  +
ISO 639-3 codes can be found here: http://www-01.sil.org/iso639-3/codes.asp
   
  +
First make a new monolingual package:
  +
<pre>
  +
python3 apertium-init.py XXX
  +
cd apertium-XXX
  +
./autogen.sh
  +
make -j
  +
cd ..
  +
</pre>
  +
  +
Then get and compile the existing monolingual package:
  +
<pre>
  +
git clone https://github.com/apertium/apertium-YYY.git
  +
cd apertium-YYY
  +
./autogen.sh
  +
make -j
  +
cd ..
  +
</pre>
   
 
Then generate the pair:
 
Then generate the pair:
  +
<pre>
 
  +
python3 apertium-init.py XXX-YYY
  +
</pre>
   
 
Then compile the pair:
 
Then compile the pair:
  +
  +
<pre>
  +
cd apertium-XXX-YYY
  +
./autogen.sh --with-lang1=../apertium-XXX --with-lang2=../apertium-YYY
  +
make -j
  +
</pre>
   
 
And test:
 
And test:
  +
<pre>
  +
echo house | apertium -d . XXX-YYY
  +
echo Haus | apertium -d . YYY-XXX
  +
</pre>
  +
  +
Now you can add words to apertium-XXX-YYY.XXX-YYY.dix, then test again:
  +
  +
<pre>
  +
make -j
  +
echo house | apertium -d . XXX-YYY
  +
echo Haus | apertium -d . YYY-XXX
  +
</pre>
  +
  +
If you had to add words to the monolingual dictionaries, you will have to type "make" in those directories first. Alternatively, there is a shortcut from the pair directory: "make langs" should make the monolingual dictionaries even if you're in the pair directory.
   
 
==With no existing monolingual packages==
 
==With no existing monolingual packages==
   
  +
Do none of the two languagues you're making a pair of already have monolingual modules in [https://apertium.github.io/apertium-on-github/source-browser.html the repository]?
First make the two monolingual packages:
 
   
  +
Then follow this part, replacing XXX and YYY for the ISO 639-3 codes of your languages:
Then compile the monolingual packages:
 
   
  +
First make and compile the new monolingual packages:
  +
<pre>
  +
python3 apertium-init.py XXX
  +
cd apertium-XXX
  +
./autogen.sh
  +
make -j
  +
cd ..
  +
  +
python3 apertium-init.py YYY
  +
cd apertium-YYY
  +
./autogen.sh
  +
make -j
  +
cd ..
  +
</pre>
   
 
Then generate the pair:
 
Then generate the pair:
  +
<pre>
 
  +
python3 apertium-init.py XXX-YYY
  +
</pre>
   
 
Then compile the pair:
 
Then compile the pair:
  +
  +
<pre>
  +
./autogen.sh --with-lang1=../apertium-XXX --with-lang2=../apertium-YYY
  +
make -j
  +
</pre>
   
 
And test:
 
And test:
  +
<pre>
  +
echo house | apertium -d . XXX-YYY
  +
echo Haus | apertium -d . YYY-XXX
  +
</pre>
  +
  +
Now you can add words to apertium-XXX-YYY.XXX-YYY.dix, then test again:
  +
  +
<pre>
  +
make -j
  +
echo house | apertium -d . XXX-YYY
  +
echo Haus | apertium -d . YYY-XXX
  +
</pre>
  +
  +
If you had to add words to the monolingual dictionaries, you will have to type "make" in those directories first. Alternatively, there is a shortcut from the pair directory: "make langs" should make the monolingual dictionaries even if you're in the pair directory.
  +
  +
==HFST and other alternative setups==
  +
If you're making a monolingual module that should use HFST/lexc, pass the option <code>--analyser=hfst</code> to apertium-init.py.
  +
  +
If you're making a pair where the "left" side (XXX in the above examples) uses HFST/lexc, pass the option <code>--analyser1=hfst</code> to apertium-init.py.
  +
  +
If you're making a pair where the "right" side (YYY in the above examples) uses HFST/lexc, pass the option <code>--analyser2=hfst</code> to apertium-init.py.
  +
  +
If you're making a pair where the both sides use HFST/lexc, pass the option <code>--analysers=hfst</code> to apertium-init.py.
   
  +
See https://github.com/apertium/apertium-init for all more documentation, or run <code>./apertium-init.py --help</code> for all options (you can e.g. also make pairs that don't use a statistical disambiguator, or don't use a Constraint Grammar disambiguator).
   
 
[[Category:Documentation]]
 
[[Category:Documentation]]
  +
[[Category:Installation]]
  +
[[Category:Documentation in English]]

Revision as of 16:33, 17 September 2020

How to use apertium-init to bootstrap a new language pair (optionally with new monolingual data packages as well).

Prerequisites

You need to get this installed first:

With two existing monolingual packages

Do the two languages you're making a pair of already have monolingual modules in the repository?

Then follow this part, replacing XXX and YYY for the ISO 639-3 codes of your languages:


First compile the monolingual packages:

git clone https://github.com/apertium/apertium-XXX.git
cd apertium-XXX
./autogen.sh
make -j
cd ..
git clone https://github.com/apertium/apertium-YYY.git
cd apertium-YYY
./autogen.sh
make -j
cd ..

Then generate the pair:

python3 apertium-init.py XXX-YYY

Then compile the pair:

./autogen.sh --with-lang1=../apertium-XXX --with-lang2=../apertium-YYY
make -j

And test:

echo house | apertium -d . XXX-YYY
echo Haus | apertium -d . YYY-XXX

Now you can add words to apertium-XXX-YYY.XXX-YYY.dix, then test again:

make -j
echo house | apertium -d . XXX-YYY
echo Haus | apertium -d . YYY-XXX

If you had to add words to the monolingual dictionaries, you will have to type "make" in those directories first. Alternatively, there is a shortcut from the pair directory: "make langs" should make the monolingual dictionaries even if you're in the pair directory.

With one existing monolingual package

Does just one of the two languagues you're making a pair of already have a monolingual module in the repository?


Then follow this part, replacing XXX and YYY for the ISO 639-3 codes of your languages; here we assume XXX needs to be made from scratch.
ISO 639-3 codes can be found here: http://www-01.sil.org/iso639-3/codes.asp

First make a new monolingual package:

python3 apertium-init.py XXX
cd apertium-XXX
./autogen.sh
make -j
cd ..

Then get and compile the existing monolingual package:

git clone https://github.com/apertium/apertium-YYY.git
cd apertium-YYY
./autogen.sh
make -j
cd ..

Then generate the pair:

python3 apertium-init.py XXX-YYY

Then compile the pair:

cd apertium-XXX-YYY
./autogen.sh --with-lang1=../apertium-XXX --with-lang2=../apertium-YYY
make -j

And test:

echo house | apertium -d . XXX-YYY
echo Haus | apertium -d . YYY-XXX

Now you can add words to apertium-XXX-YYY.XXX-YYY.dix, then test again:

make -j
echo house | apertium -d . XXX-YYY
echo Haus | apertium -d . YYY-XXX

If you had to add words to the monolingual dictionaries, you will have to type "make" in those directories first. Alternatively, there is a shortcut from the pair directory: "make langs" should make the monolingual dictionaries even if you're in the pair directory.

With no existing monolingual packages

Do none of the two languagues you're making a pair of already have monolingual modules in the repository?

Then follow this part, replacing XXX and YYY for the ISO 639-3 codes of your languages:

First make and compile the new monolingual packages:

python3 apertium-init.py XXX
cd apertium-XXX
./autogen.sh
make -j
cd ..

python3 apertium-init.py YYY
cd apertium-YYY
./autogen.sh
make -j
cd ..

Then generate the pair:

python3 apertium-init.py XXX-YYY

Then compile the pair:

./autogen.sh --with-lang1=../apertium-XXX --with-lang2=../apertium-YYY
make -j

And test:

echo house | apertium -d . XXX-YYY
echo Haus | apertium -d . YYY-XXX

Now you can add words to apertium-XXX-YYY.XXX-YYY.dix, then test again:

make -j
echo house | apertium -d . XXX-YYY
echo Haus | apertium -d . YYY-XXX

If you had to add words to the monolingual dictionaries, you will have to type "make" in those directories first. Alternatively, there is a shortcut from the pair directory: "make langs" should make the monolingual dictionaries even if you're in the pair directory.

HFST and other alternative setups

If you're making a monolingual module that should use HFST/lexc, pass the option --analyser=hfst to apertium-init.py.

If you're making a pair where the "left" side (XXX in the above examples) uses HFST/lexc, pass the option --analyser1=hfst to apertium-init.py.

If you're making a pair where the "right" side (YYY in the above examples) uses HFST/lexc, pass the option --analyser2=hfst to apertium-init.py.

If you're making a pair where the both sides use HFST/lexc, pass the option --analysers=hfst to apertium-init.py.

See https://github.com/apertium/apertium-init for all more documentation, or run ./apertium-init.py --help for all options (you can e.g. also make pairs that don't use a statistical disambiguator, or don't use a Constraint Grammar disambiguator).