Apertium-init

From LING073
Revision as of 13:57, 19 March 2019 by Jwashin1 (Talk | contribs)

Jump to: navigation, search

You can the apertium-init tool to create ("bootstrap") a directory for quick development of a transducer or translation pair.

Installing apertium-init

If needed, download apertium-init and install it:

Creating a language module

Create an hfst-based apertium language module (in your ~/ling073 directory), replacing xyz with the ISO code of your language in all occurrences:

  • apertium-init -a hfst xyz

Rename the module ling073-xyz if you want (so that it matches what will be in github later, and any further instructions):

  • mv apertium-xyz ling073-xyz

Notes:

  • If get an error about SVN and the directory not being a working copy, then you have an old version of apertium-init.
  • If something goes wrong (e.g., you make a typo), delete any directories/files that were created and try the step again.

For the first day assignment, skip down to #Push to github

Bootstrapping a translation pair

To bootstrap a translation pair whose primary function is to translate from language xyz to language abc, do the following:

  1. Make sure you have a copy of both of the language modules you'll need (one for each language). Apertium's github repository has transducers for a lot of languages.
    • I recommend that you fork the transducer on github (i.e., copy the project to your own github account) so that you can make changes to it easily as needed (and potentially submit those changes back to Apertium at some point). For this you'll need a github.com account, you'll need to set up an ssh key for it, and you'll need to make sure both members of your group have write access to it.
  2. Check which formalism each transducer is written in.
    • The transducer you've written so far in this class should be written using HFST (using lexc and twol). If the transducer that the module you cloned for the other language has a file like apertium-abc.abc.dix, then it's written using lttoolbox.
  3. The following command will initialise the directory for the translation pair:
    • apertium-init -a1 hfst -a2 hfst xyz-abc
    • The -a1 and -a2 arguments tell apertium-init what formalism your transducers are written in. You may need to say "lttoolbox" instead of "hfst" for one or more of those options.
  4. Rename the directory to ling073-xyz-abc.
  5. Create a ling073-xyz-abc repository in the semester's github group (Ling073-sp19), set a remote origin in your repo, and push (for the last two, see #Push to github below). Make sure all members of your group have access to the repository.
  6. Initialise the compiler (needed once for each copy of the new directory) with the following command:
    • ./autogen.sh --with-lang1=/path/to/ling073-xyz --with-lang2=/path/to/apertium-abc
    • You'll need to substitute /path/to/ling-xyz and /path/to/apertium-abc with the paths to the source-language transducer and the target-language transducer, respectively.
  7. Compile with make as always.

Pushing to github

If this is a language pair you would like to push to github, do the following ideally before modifying any files or compiling the module:

  1. Create an empty (no files) repository named ling073-xyz on github.
  2. Make sure the repository really was created correctly by running git log. You should see a single commit named "initial commit".
  3. Set the github repository you created as the remote origin:
    • git remote add origin git@github.swarthmore.edu:username/ling073-xyz.git (replacing "username" and "xyz" below as appropriate)
  4. Push the bootstrapped module to origin:
    • git push --set-upstream origin master
  5. After this you should be able to see the same files from the github web interface and in the directory. You should also be able to commit, push, pull, etc. all normally.