#!/bin/bash base_dir=$(readlink -f "$(dirname "$0")") depth=$1 shift if [ ! -s "${base_dir}/.words.${depth}" ]; then urls=() for i in $(seq "${depth}"); do urls=( $( "${base_dir}/dive-into-wikipedia.sh" "${urls[@]}" \ | sort -u ) ) echo $i >&2 done printf '%s\n' "${urls[@]}" \ | parallel -j0 -n1 "${base_dir}/remove-tags.sh" \ | sort -u \ | grep -vxF '' \ > "${base_dir}/.words.${depth}" fi "${base_dir}/markov" "${base_dir}/.words.${depth}" "$@"