<commit_before>#!/bin/bash

if [ -z "${JENKINS_WEB}" -o -z "${SCRIPT_LIBRARY_PATH}" ]; then
  echo 'ERROR: required variables are empty and should not be.' >&2
  echo "JENKINS_WEB = ${JENKINS_WEB}" >&2
  echo "SCRIPT_LIBRARY_PATH = ${SCRIPT_LIBRARY_PATH}" >&2
  exit 1
fi

if ! type -P gawk; then
  echo 'ERROR: GNU awk is required.' >&2
  echo 'If on Mac, "brew install gawk".' >&2
  echo "Otherwise, install GNU awk for the platform you're using" >&2
  exit 1
fi

# GNU or BSD sed is required.  Homebrew on Mac installs GNU sed as gsed.
# Try to detect gsed; otherwise, fall back to detecting OS for using sed.
SED=()
if type -P gsed &> /dev/null; then
  SED=(gsed -r)
elif [ "$(uname -s)" = "Darwin" ] || uname -s | grep -- 'BSD$' &> /dev/null; then
  SED=(sed -E)
else
  # assume Linux GNU sed
  SED=(sed -r)
fi

function cleanup_temp_on() {
  [ -z "${TMP_DIR}" ] || rm -rf "${TMP_DIR}"
}
trap cleanup_temp_on EXIT
<commit_msg>Bugfix for Ubuntu 20.04<commit_after>#!/bin/bash

if [ -z "${JENKINS_WEB}" -o -z "${SCRIPT_LIBRARY_PATH}" ]; then
  echo 'ERROR: required variables are empty and should not be.' >&2
  echo "JENKINS_WEB = ${JENKINS_WEB}" >&2
  echo "SCRIPT_LIBRARY_PATH = ${SCRIPT_LIBRARY_PATH}" >&2
  exit 1
fi

function gawk() {
  if [ "$(uname)" = Linux ]; then
    command awk "$@"
  elif type -P gawk &> /dev/null; then
    command gawk "$@"
  else
    echo 'ERROR: GNU awk is required.' >&2
    echo '    If on Mac, "brew install gawk".' >&2
    echo "    Otherwise, install GNU awk for the platform you're using" >&2
    exit 1
  fi
}

# GNU or BSD sed is required.  Homebrew on Mac installs GNU sed as gsed.
# Try to detect gsed; otherwise, fall back to detecting OS for using sed.
SED=()
if type -P gsed &> /dev/null; then
  SED=(gsed -r)
elif [ "$(uname -s)" = "Darwin" ] || uname -s | grep -- 'BSD$' &> /dev/null; then
  SED=(sed -E)
else
  # assume Linux GNU sed
  SED=(sed -r)
fi

function cleanup_temp_on() {
  [ -z "${TMP_DIR}" ] || rm -rf "${TMP_DIR}"
}
trap cleanup_temp_on EXIT

{'fraction_non_alphanumeric': 0.15380786460925833, 'fraction_numerical': 0.009955201592832254, 'mean_word_length': 3.240506329113924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '1544605', 'n_tokens_mistral': 817, 'n_tokens_neox': 779, 'n_words': 275}