#!/bin/sh -e

words() {
  tr '[:upper:]' '[:lower:]' \
    | sed -E 's/[ \t]+/\n/g' \
    | sed -e 's/[^0-9a-z]//g' -e '/^$/d' \
    | sort \
    | uniq -c \
    | sort -n -r -S 50M
}

wf() {
  word="$1"
  freqf="$2"
  awk "/\<${word}\>/{ print \$1 }" "${freqf}"
}
