<commit_before>#!/bin/bash

#
# Log <type> <msg>
log() {
  local label=$1
  shift
  printf "\x1B[36m%s\x1B[0m :" $label
  printf " \x1B[90m$@\x1B[0m\n"
}

#
# Exit with the given <msg ...>
abort() {
  printf "\n\x1B[31mError: $@\x1B[0m\n\n"
  exit 1
}

# print versions
echo "npm -v"
npm -v
echo

echo "node -v"
node -v
echo

echo "mocha-phantomjs -V"
./node_modules/.bin/mocha-phantomjs -V
echo

node node/build normal || abort "fails to build neuron"
echo 
echo "build : success"

node node/create-jshintrc || abort "fails to create .jshintrc"
echo "jshint: success"
echo

./node_modules/.bin/jshint ./dist/neuron.js || abort "jshint not pass"

# test for node
log "node" "node.js"
./node_modules/.bin/mocha --reporter spec ./test/node.js || abort "unit test for node/neuron.js failed"

for file in `ls -1 test/*.html`; do
  log "test" "$file"
  ./node_modules/.bin/mocha-phantomjs "http://localhost:8030/$file" || abort "unit test for browser/neuron.js failed"
done
<commit_msg>fixes sqr color in cli<commit_after>#!/bin/bash

#
# Log <type> <msg>
#

log() {
  printf "\033[36m%s\033[0m : \033[90m%s\033[0m\n" $1 $2
}

#
# Exit with the given <msg ...>
#

abort() {
  printf "\n\033[31mError: $@\033[0m\n\n" && exit 1
}


# print versions
echo "npm -v"
npm -v
echo

echo "node -v"
node -v
echo

echo "mocha-phantomjs -V"
./node_modules/.bin/mocha-phantomjs -V
echo

node node/build normal || abort "fails to build neuron"
echo 
echo "build : success"

node node/create-jshintrc || abort "fails to create .jshintrc"
echo "jshint: success"
echo

./node_modules/.bin/jshint ./dist/neuron.js || abort "jshint not pass"

# test for node
log "node" "node.js"
./node_modules/.bin/mocha --reporter spec ./test/node.js || abort "unit test for node/neuron.js failed"

for file in `ls -1 test/*.html`; do
  log "test" "$file"
  ./node_modules/.bin/mocha-phantomjs "http://localhost:8030/$file" || abort "unit test for browser/neuron.js failed"
done

{'fraction_non_alphanumeric': 0.17104585265327152, 'fraction_numerical': 0.02936630602782071, 'mean_word_length': 3.364044943820225, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6447340', 'n_tokens_mistral': 846, 'n_tokens_neox': 794, 'n_words': 217}