Skip to content

Installing External Libraries

Isaac Schifferer edited this page Aug 27, 2024 · 5 revisions

External Libraries

Some libraries used in SILNLP are not Python libraries and need to be installed separately. These do not need to be installed for SILNLP to work, but if you need to use one of them specifically, follow the corresponding instructions below.

eflomal

Note: If you are using SILNLP in a Docker container, eflomal should already be installed and ready to use. If you are using SILNLP in the VS Code Dev Container, you will have to specify the eflomal "extra" when installing your poetry environment (step 2).

  1. Install dependencies. If you are using Windows or Mac, skip this step.

    In a terminal, run:

    sudo apt-get update
    sudo apt-get install python3-dev
    
  2. Add eflomal to your poetry environment.

    In a terminal, run:

    poetry install -E eflomal
    
  3. Set environment variable.

    Add the following line to your .bashrc file in your home directory:

    export EFLOMAL_PATH="path/to/venv/lib/python3.8/site-packages/eflomal/bin"
    

    Replace "path/to/venv" with the path to the virtual environment created by poetry.

fast_align

Note: fast_align is already implemented in the machine library and can be used by specifying the aligner "fast_align". The steps below are only necessary if you want to build the library from source. To use the aligner built from source, specify the aligner "clab_fast_align".

  1. Install dependencies.

    In a terminal, run:

    sudo apt-get update
    sudo apt-get install cmake make libgoogle-perftools-dev libsparsehash-dev
    
  2. Install fast_align.

    In a terminal, run:

    git clone https://github.com/clab/fast_align.git
    mkdir fast_align/build
    cmake -S fast_align -B fast_align/build
    make -C fast_align/build
    mv fast_align/build/atools fast_align/build/fast_align /usr/local/bin
    rm -rf fast_align
    
  3. Set environment variable.

    Add the following line to your .bashrc file in your home directory:

    export FAST_ALIGN_PATH="/usr/local/bin"
    

mgiza

  1. Install dependencies.

    In a terminal, run:

    sudo apt-get update
    sudo apt-get install cmake make libboost-all-dev
    
  2. Install mgiza.

    In a terminal, run:

    git clone https://github.com/moses-smt/mgiza.git
    cmake -S mgiza/mgizapp -B mgiza/mgizapp
    make -C mgiza/mgizapp
    make -C mgiza/mgizapp install
    mv mgiza/mgizapp/inst/mgiza mgiza/mgizapp/inst/mkcls mgiza/mgizapp/inst/plain2snt mgiza/mgizapp/inst/snt2cooc /usr/local/bin
    rm -rf mgiza
    
  3. Set environment variable.

    Add the following line to your .bashrc file in your home directory:

    export MGIZA_PATH="/usr/local/bin"
    

meteor

  1. Install dependencies.

    In a terminal, run:

    sudo apt-get update
    sudo apt-get install wget tar
    
  2. Install meteor.

    In a terminal, run:

    wget "https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz"
    tar -xf jdk-21_linux-x64_bin.tar.gz
    rm jdk-21_linux-x64_bin.tar.gz
    wget "http://www.cs.cmu.edu/~alavie/METEOR/download/meteor-1.5.tar.gz"
    tar -xf meteor-1.5.tar.gz
    rm meteor-1.5.tar.gz
    mv meteor-1.5/meteor-1.5.jar /usr/local/bin
    rm -rf meteor-1.5
    
  3. Set environment variable.

    Add the following line to your .bashrc file in your home directory:

    export METEOR_PATH="/usr/local/bin"