Apertium-Init (a.k.a. Apertium Bootstrap)
Bootstrap Apertium language modules and pairs using apertium-init.py.
Installation
There are 3 ways to obtain Apertium-Init:
- Download the script from https://apertium.org/apertium-init to your local directory
- Clone this repository and run
make install - Install from PyPi with
pip install apertium-init
If the script was downloaded directly, it can be run with python3 apertium-init.py. Otherwise it will be installed as apertium-init.
Usage
Usage depends on the desired module and is described below. Remember to
search for TODO in the generated module to add example sentences, etc.
Monolingual Lttoolbox module
To bootstrap a monolingual language module apertium-foo using the
lttoolbox formalism,
$ python3 apertium-init.py foo
To bootstrap and compile it at the same time,
$ python3 apertium-init.py foo && ( cd apertium-foo/ && make )
Monlingual HFST module
To bootstrap a monolingual language module apertium-foo using the
HFST formalism,
$ python3 apertium-init.py foo --analyser=hfst
To bootstrap and compile it at the same time,
$ python3 apertium-init.py foo --analyser=hfst && ( cd apertium-foo/ && make )
To include a twoc file for handling prefixes,
$ python3 apertium-init.py foo --analyser=hfst --with-twoc
To include a spellrelax file for handling typographical variance,
$ python3 apertium-init.py foo --analyser=hfst --with-spellrelax
Bilingual Lttoolbox module
To bootstrap a bilingual language module apertium-foo-bar where the
monolingual packages apertium-foo and apertium-bar both use the
lttoolbox formalism,
$ python3 apertium-init.py foo-bar
To bootstrap and compile it at the same time,
$ python3 apertium-init.py foo-bar && ( cd apertium-foo-bar/ && ./autogen.sh && make test)
Bilingual HFST/Lttoolbox module
To bootstrap a bilingual language module apertium-foo-bar where the
monolingual packages apertium-foo and apertium-bar use the
HFST formalism and/or the
lttoolbox formalism,
$ python3 apertium-init.py foo-bar --analysers=hfst # Both foo and bar use HFST
$ python3 apertium-init.py foo-bar --analyser1=hfst # Only foo (first language) uses HFST
$ python3 apertium-init.py foo-bar --analyser2=hfst # Only bar (second language) uses HFST
To bootstrap and compile it at the same time,
$ python3 apertium-init.py foo-bar --analysers=hfst && ( cd apertium-foo-bar/ && ./autogen.sh && make test) # Both foo and bar use HFST
$ python3 apertium-init.py foo-bar --analyser1=hfst && ( cd apertium-foo-bar/ && ./autogen.sh && make test) # Only foo (first language) uses HFST
$ python3 apertium-init.py foo-bar --analyser2=hfst && ( cd apertium-foo-bar/ && ./autogen.sh && make test) # Only bar (second language) uses HFST
Bilingual module for monolinguals that don't use apertium-tagger or CG
To bootstrap a bilingual module when one or both of the monolingual modules don't use apertium-tagger,
$ python3 apertium-init.py foo-bar --no-prob1 # Only foo doesn't have .prob
$ python3 apertium-init.py foo-bar --no-prob2 # Only bar doesn't have .prop
$ python3 apertium-init.py foo-bar --no-prob1 --no-prob2 # Neither foo nor bar have .prob
To bootstrap a bilingual module when one or both of the monolingual modules don't use CG,
$ python3 apertium-init.py foo-bar --no-rlx1 # Only foo doesn't have .rlx
$ python3 apertium-init.py foo-bar --no-rlx2 # Only bar doesn't have .rlx
$ python3 apertium-init.py foo-bar --no-rlx1 --no-rlx2 # Neither foo nor bar have .rlx
Bilingual module using recursive transfer
To bootstrap a bilingual module which uses apertium-recursive,
$ python3 apertium-init.py foo-bar --transfer=rtx
Bilingual module with anaphora resolution
To bootstrap a bilingual module which uses apertium-anaphora,
$ python3 apertium-init.py foo-bar --with-anaphora
Bilingual module with discontiguous multiwords
To bootstrap a bilingual module which uses apertium-separable,
$ python3 apertium-init.py foo-bar --with-separable
Adding features to an existing module
Apertium-init can reconfigure an existing module or pair. For example, to add apertium-separable to an existing pair:
$ python3 apertium-init.py foo-bar -r --with-separable
Note that all desired options must be specified. If the foo-bar pair used apertium-anaphora, the above command would remove it.
Pushing to Github
To bootstrap a module or pair and also add it to the apertium incubator,
$ python3 apertium-init.py foo -p # Bootstrap module apertium-foo and push to Github
$ python3 apertium-init.py foo-bar -p # Bootstrap pair apertium-foo-bar and push to Github
To specify what username to push as (rather than relying on git config),
$ python3 apertium-init.py foo -p -u bar # Bootstrap module apertium-foo and push to Github under username bar
Development
After updating vanilla files, run make in the root of the repository to
generate apertium-init.py.
You can also do sudo make install to install to /usr/local/bin/apertium-init
or e.g. PREFIX=$HOME/local make install to install to
$HOME/local/bin/apertium-init.
Use pipenv install --dev to install the requirements required for development,
e.g. linters.
Releasing
After installing development resources following the instructions above, deploying to PyPi is relatively straightforward.
Use make dist to create a source distributable inside the dist directory
that can be installed locally via pip.
Use make test-release and make release to deploy to the testing PyPi
instance and the production PyPi
instance respectively. Either step requires PyPi
authentication credentials with access to the apertium-init package.
Release files for apertium-init 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| apertium-init-3.0.0.tar.gz | 239.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apertium_init-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 366.5 kB
Release files / apertium-init-3.0.0.tar.gz
| Download URL | apertium-init-3.0.0.tar.gz |
|---|---|
| Size | 239.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0689a975686b586c558cbd1b91b65851691d59f0bf577e8133af3ba9e1af93b2
|
|
BLAKE2b-256 checksum How to use checksums |
1d599ea59d743060057dde8787a2fdc819be7d7fec318234596e2839fecf971e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|
Release files / apertium_init-3.0.0-py3-none-any.whl
| Download URL | apertium_init-3.0.0-py3-none-any.whl |
|---|---|
| Size | 126.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d792c3a4686a81f93584ff0ceda64836c9d07970fa698b6674c4488062b6a2c0
|
|
BLAKE2b-256 checksum How to use checksums |
0ded63fd15d07fecd8ea037065769e95e5b8b23276fd87b6727402e74906c2f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|