<commit_before>#!/bin/bash
#
# https://github.com/timrdf/csv2rdf4lod-automation/blob/master/bin/util/cr-headers.sh

CSV2RDF4LOD_HOME=${CSV2RDF4LOD_HOME:?"not set; source csv2rdf4lod/source-me.sh or see https://github.com/timrdf/csv2rdf4lod-automation/wiki/CSV2RDF4LOD-not-set"}

# cr:data-root cr:source cr:directory-of-datasets cr:dataset cr:directory-of-versions cr:conversion-cockpit
ACCEPTABLE_PWDs="cr:directory-of-versions cr:conversion-cockpit"
if [ `${CSV2RDF4LOD_HOME}/bin/util/is-pwd-a.sh $ACCEPTABLE_PWDs` != "yes" ]; then
   ${CSV2RDF4LOD_HOME}/bin/util/pwd-not-a.sh $ACCEPTABLE_PWDs
   exit 1
fi

write="no"
if [[ "$1" == "-w" || "$1" == "--write" ]]; then
   write="yes"
fi

if [ `$CSV2RDF4LOD_HOME/bin/util/is-pwd-a.sh cr:conversion-cockpit` == "yes" ]; then<commit_msg>headers of file<commit_after>#!/bin/bash
#
# https://github.com/timrdf/csv2rdf4lod-automation/blob/master/bin/util/cr-headers.sh
#
# Usage:
#
#    cr-headers.sh --number 2011-Nov-28/source/WhiteHouse-WAVES-Released-0611.csv 
#    1 NAMELAST
#    2 NAMEFIRST
#    3 NAMEMID
#    4 UIN
#    5 BDGNBR
#    6 ACCESS_TYPE


CSV2RDF4LOD_HOME=${CSV2RDF4LOD_HOME:?"not set; source csv2rdf4lod/source-me.sh or see https://github.com/timrdf/csv2rdf4lod-automation/wiki/CSV2RDF4LOD-not-set"}

# cr:data-root cr:source cr:directory-of-datasets cr:dataset cr:directory-of-versions cr:conversion-cockpit
ACCEPTABLE_PWDs="cr:directory-of-versions cr:conversion-cockpit"
if [ `${CSV2RDF4LOD_HOME}/bin/util/is-pwd-a.sh $ACCEPTABLE_PWDs` != "yes" ]; then
   ${CSV2RDF4LOD_HOME}/bin/util/pwd-not-a.sh $ACCEPTABLE_PWDs
   exit 1
fi

write="no"
if [[ "$1" == "-w" || "$1" == "--write" ]]; then
   write="yes"
   shift
fi

# If a file is given, print its headers
if [ $# -gt 0 ]; then

   number=""
   if [[ "$1" == "-N" || "$1" == "--number" ]]; then
      number="--number"
      shift
   fi

   while [ $# -gt 0 ]; do
      csv="$1"
      java edu.rpi.tw.data.csv.impl.CSVHeaders $csv $number
      shift
   done
   exit 0
fi

if [ `$CSV2RDF4LOD_HOME/bin/util/is-pwd-a.sh cr:conversion-cockpit` == "yes" ]; then
{'fraction_non_alphanumeric': 0.1776600866634569, 'fraction_numerical': 0.030813673567645642, 'mean_word_length': 3.810185185185185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '5862934', 'n_tokens_mistral': 932, 'n_tokens_neox': 895, 'n_words': 136}