<commit_before>#!/bin/bash

if [ "$#" -eq 0 ]; then
	echo "Usage: $0 path/to/input.boa output-dir/ [options]"
fi

BASEDIR=$(dirname "$0")

java -cp ".:$BASEDIR/dist/boa-compiler.jar:$BASEDIR/lib/*:$BASEDIR/lib/evaluator/*:$BASEDIR/compile" boa.BoaMain -e -d dataset/ -i $1 -o $2 $*<commit_msg>make evaluator script more robust to inputs<commit_after>#!/bin/bash

if [ "$#" -ne 2 ]; then
	echo "Usage: $0 path/to/input.boa output-dir/ [options]"
	exit -1
fi

if [ ! -f $1 ]; then
	echo "input '$1' is not a file"
	exit -2
fi

if [ -d $2 ]; then
    read -n 1 -p "output directory '$2' exists - delete? [Y/n] " yn
	echo ""

	yn=`echo $yn | tr '[:upper:]' '[:lower:]'`

	if [[ $yn =~ ^(y| ) ]] | [ -z $yn ]; then
        rm -Rf $2
	else
		echo "Please remove or provide a different output directory."
		exit -3
	fi
fi

BASEDIR=$(dirname "$0")

java -cp ".:$BASEDIR/dist/boa-compiler.jar:$BASEDIR/lib/*:$BASEDIR/lib/evaluator/*:$BASEDIR/compile" boa.BoaMain -e -d dataset/ -i $1 -o $2 $*
{'fraction_non_alphanumeric': 0.20956256358087488, 'fraction_numerical': 0.019328585961342827, 'mean_word_length': 3.1171548117154813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3541155', 'n_tokens_mistral': 425, 'n_tokens_neox': 414, 'n_words': 116}