<commit_before>#!/usr/bin/env bash 

#
# Install the dependencies needed to run AMDTK.
# 

# We avoid symbolic links as it may confuses the installation process.
amdtk_root=$(pwd -P)

anaconda_path="$HOME/anaconda3"
env_name="py35_amdtk"

while getopts ":e:hp:" opt; do
    case $opt in
        e) 
            env_name=$OPTARG
            ;;
        p)
            anaconda_path=$OPTARG
            ;;
        h)
            echo "usage: $0 [OPTIONS]                                         "
            echo "                                                            "
            echo "Install the dependencies needed to run AMDTK recipes.       "
            echo "                                                            "
            echo "Options:                                                    "
            echo "  -e NAME     Anaconda environment name. Default: $env_name."
            echo "  -h          Show this message.                            "
            echo "  -p PATH     Path to an existing Anaconda distribution.    "
            echo "              Default: $anaconda_path.                      "
            exit 0
            ;;
        \?) 
            echo "Invalid option: -$OPTARG" >&2
            exit 1
            ;;
        :)
            echo "Option -$OPTARG requires an argument." >&2
            exit 1
            ;;
    esac
done

if [ ! -e "$anaconda_path/bin/python" ]; then
    echo "Invalid anaconda path. Exiting the installation script."
    exit 1
fi

# Directory where we will install the external tools.
mkdir -p $amdtk_root/tools

# Set the path to the correct python distribution for the the rest of the 
# installation.
unset PYTHONPATH
export PATH=$anaconda_path/bin:$PATH

# We create a specific environment for AMDTK if it doesn't exists.
echo "Installing anaconda environment \"$env_name\"... "
if [ -z "`conda env list | grep $env_name`" ]; then
    conda env create --name $env_name python=3 -f "$amdtk_root/py35_amdtk.yml"
fi || exit 1

# Activate the new environment to install other dependencies.
source activate $env_name

# Install sselogsumexp.
echo "Installing sselogsumexp... "
if [ ! -e "$amdtk_root/tools/logsumexp" ]; then
    cd "$amdtk_root/tools"
    git clone "https://github.com/rmcgibbo/logsumexp.git" 
    cd logsumexp
    python setup.py install 
    cd "$amdtk_root"
fi || exit 1

# Download and install sph2pipe. This is needed for features extraction.
echo "Installing sph2pipe... "<commit_msg>minor fixup - removing unneeded lines<commit_after>#!/usr/bin/env bash 

#
# Install the dependencies needed to run AMDTK.
# 

# We avoid symbolic links as it may confuses the installation process.
amdtk_root=$(pwd -P)

anaconda_path="$HOME/anaconda3"
env_name="py35_amdtk"

while getopts ":e:hp:" opt; do
    case $opt in
        e) 
            env_name=$OPTARG
            ;;
        p)
            anaconda_path=$OPTARG
            ;;
        h)
            echo "usage: $0 [OPTIONS]                                         "
            echo "                                                            "
            echo "Install the dependencies needed to run AMDTK recipes.       "
            echo "                                                            "
            echo "Options:                                                    "
            echo "  -e NAME     Anaconda environment name. Default: $env_name."
            echo "  -h          Show this message.                            "
            echo "  -p PATH     Path to an existing Anaconda distribution.    "
            echo "              Default: $anaconda_path.                      "
            exit 0
            ;;
        \?) 
            echo "Invalid option: -$OPTARG" >&2
            exit 1
            ;;
        :)
            echo "Option -$OPTARG requires an argument." >&2
            exit 1
            ;;
    esac
done

if [ ! -e "$anaconda_path/bin/python" ]; then
    echo "Invalid anaconda path. Exiting the installation script."
    exit 1
fi

# Set the path to the correct python distribution for the the rest of the 
# installation.
unset PYTHONPATH
export PATH=$anaconda_path/bin:$PATH

# We create a specific environment for AMDTK if it doesn't exists.
echo "Installing anaconda environment \"$env_name\"... "
if [ -z "`conda env list | grep $env_name`" ]; then
    conda env create --name $env_name python=3 -f "$amdtk_root/py35_amdtk.yml"
fi || exit 1

# Activate the new environment to install other dependencies.
source activate $env_name

# Install sselogsumexp.
echo "Installing sselogsumexp... "
if [ ! -e "$amdtk_root/tools/logsumexp" ]; then
    cd "$amdtk_root/tools"
    git clone "https://github.com/rmcgibbo/logsumexp.git" 
    cd logsumexp
    python setup.py install 
    cd "$amdtk_root"
fi || exit 1

# Download and install sph2pipe. This is needed for features extraction.
echo "Installing sph2pipe... "
{'fraction_non_alphanumeric': 0.08665581773799837, 'fraction_numerical': 0.006916192026037429, 'mean_word_length': 1.5099540581929556, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3972127', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1346, 'n_words': 447}