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

if [ "$1" = "--reverse" ]
then
    cd autoload/leaderf/fuzzyMatch_C
    rm -rf build
    rm -f ../python/*.so
    echo "C extension uninstalled sucessfully!"
    exit 0
fi

cd autoload/leaderf/fuzzyMatch_C
echo "Begin to compile C extension of Python2 ..."
python setup.py build
if [ $? -eq 0 ]
then
    cp build/lib*2.?/fuzzyMatchC*.so ../python
    if [ $? -eq 0 ]
    then
        echo
        echo C extension of Python2 installed sucessfully!
    fi
fi

echo
echo "Begin to compile C extension of Python3 ..."
python3 setup.py build
if [ $? -eq 0 ]
then
    cp build/lib*3.?/fuzzyMatchC*.so ../python
    if [ $? -eq 0 ]
    then
        echo
        echo C extension of Python3 installed sucessfully!
    fi
fi<commit_msg>Add if python is present in system (#218)<commit_after>#!/usr/bin/env bash

if [ "$1" = "--reverse" ]
then
    cd autoload/leaderf/fuzzyMatch_C
    rm -rf build
    rm -f ../python/*.so
    echo "C extension uninstalled sucessfully!"
    exit 0
fi

no_python=true

cd autoload/leaderf/fuzzyMatch_C

if command -v python2 > /dev/null 2>&1; then
  no_python=false
  echo "Begin to compile C extension of Python2 ..."
  python2 setup.py build
  if [ $? -eq 0 ]
  then
      cp build/lib*2.?/fuzzyMatchC*.so ../python
      if [ $? -eq 0 ]
      then
          echo
          echo C extension of Python2 installed sucessfully!
      fi
  fi
fi

if command -v python3 > /dev/null 2>&1; then
  $no_python || echo
  no_python=false
  
  echo "Begin to compile C extension of Python3 ..."
  python3 setup.py build
  if [ $? -eq 0 ]
  then
      cp build/lib*3.?/fuzzyMatchC*.so ../python
      if [ $? -eq 0 ]
      then
          echo
          echo C extension of Python3 installed sucessfully!
      fi
  fi
fi

if $no_python; then
  echo "Can't compile C extension, please install Python2 or Python3" >&2
  exit 1
fi
{'fraction_non_alphanumeric': 0.10927505330490406, 'fraction_numerical': 0.021321961620469083, 'mean_word_length': 2.225085910652921, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3972118', 'n_tokens_mistral': 694, 'n_tokens_neox': 643, 'n_words': 221}