<commit_before>#!/bin/bash
# Script to set up botbot.
# Written by <NAME> and <NAME>.

NAME='BotBot'
BASE="$HOME/.botbot"
CWD=`pwd`
INSTALL_TEST_SUITE=0

function usage()
{
    cat <<EOF
Usage: $0 [flags]

Flags
-----
-b | Set the base install directory for botbot.
-h | Print this help message.
-t | Install test suite as well.
EOF
    exit 0
}

function color()
{
    local RED='\033[1;31m'
    local GREEN='\033[1;32m'
    local NC='\033[0m'

    case "$1" in
        1) echo -e "$RED$2$NC"
           ;;
        2) echo -e "$GREEN$2$NC"
           ;;
    esac
}

function red()
{
    color 1 "$1"
}

function green()
{
    color 2 "$1"
}

function parse-args()
{
    while [[ $# -gt 0 ]]
    do
        local key="$1"
        case $key in
            "-h"|"--help")
                usage
                shift
                exit
                ;;
            "-b"|"--base")
                BASE=$2
                shift
                ;;
            "-t"|"--tests")
                INSTALL_TEST_SUITE=1
                shift
                ;;
            *)
                usage
                exit 1
                ;;
        esac
    done
}

function install-conda-by-hand()
{
    CONDA_INSTALL_LOCAL=1

    cd $BASE
    mkdir conda

    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh &&
    bash miniconda.sh -b -f -p $BASE/conda &&
    rm -f miniconda.sh

    green "Installed conda at $BASE..."

    cd $CWD

    local PATH_PREFIX='PATH=$PATH:'
    local NEW_PATH=$BASE/conda/bin
    echo "$PATH_PREFIX" > setenv.sh
    source setenv.sh
}

function check-conda-install()
{
    CONDA=`command -v conda`

    if [[ -z $CONDA ]]; then
        red "conda is not installed. Attempting to install..."
        echo "Note: if you do not have sudo privileges, conda will be installed locally."
        sudo pip install conda
        local _conda_install_result=$?

        if [[ $_conda_install_result -ne 0 ]]; then
            red "Could not install conda using pip. Attempting to install in $BASE..."

            install-conda-by-hand
        else
            green "Successfully installed conda..."
        fi
    else
        green "Using conda install found at $CONDA..."<commit_msg>Actually implement the change from the preious commit<commit_after>#!/bin/bash
# Script to set up botbot.
# Written by <NAME> and <NAME>.

NAME='BotBot'
BASE="$HOME/.botbot"
CWD=`pwd`
INSTALL_TEST_SUITE=0

function usage()
{
    cat <<EOF
Usage: $0 [flags]

Flags
-----
-b | Set the base install directory for botbot.
-h | Print this help message.
-t | Install test suite as well.
EOF
    exit 0
}

function color()
{
    local RED='\033[1;31m'
    local GREEN='\033[1;32m'
    local NC='\033[0m'

    case "$1" in
        1) echo -e "$RED$2$NC"
           ;;
        2) echo -e "$GREEN$2$NC"
           ;;
    esac
}

function red()
{
    color 1 "$1"
}

function green()
{
    color 2 "$1"
}

function parse-args()
{
    while [[ $# -gt 0 ]]
    do
        local key="$1"
        case $key in
            "-h"|"--help")
                usage
                shift
                exit
                ;;
            "-b"|"--base")
                BASE=$2
                shift
                ;;
            "-t"|"--tests")
                INSTALL_TEST_SUITE=1
                shift
                ;;
            *)
                usage
                exit 1
                ;;
        esac
    done
}

function install-conda-by-hand()
{
    CONDA_INSTALL_LOCAL=1

    cd $BASE
    mkdir conda

    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh &&
    bash miniconda.sh -b -f -p $BASE/conda &&
    rm -f miniconda.sh

    green "Installed conda at $BASE..."

    cd $CWD

    local PATH_PREFIX='PATH=$PATH:'
    local NEW_PATH="$BASE/conda/bin"
    echo "$PATH_PREFIX$NEW_PATH" > setenv.sh
    source setenv.sh
}

function check-conda-install()
{
    CONDA=`command -v conda`

    if [[ -z $CONDA ]]; then
        red "conda is not installed. Attempting to install..."
        echo "Note: if you do not have sudo privileges, conda will be installed locally."
        sudo pip install conda
        local _conda_install_result=$?

        if [[ $_conda_install_result -ne 0 ]]; then
            red "Could not install conda using pip. Attempting to install in $BASE..."

            install-conda-by-hand
        else
            green "Successfully installed conda..."
        fi
    else
        green "Using conda install found at $CONDA..."
{'fraction_non_alphanumeric': 0.12414553472987871, 'fraction_numerical': 0.017640573318632856, 'mean_word_length': 1.5949656750572083, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1003370', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1439, 'n_words': 418}