snipe

bot for a simple IRC game to make people say words
git clone https://a3nm.net/git/snipe/
Log | Files | Refs

make_missions.sh (496B)


      1 #!/bin/bash
      2 
      3 # $1 is upper bound for freq
      4 # $2 is lower bound for freq
      5 # $3 is minimal len for word
      6 
      7 cut -d '>' -f 2- |
      8   tr "_':\*/()[]\".,;?<>#$! \t-" '\n' |
      9   sed '/^ *$/d' |
     10   tr 'A-Z' 'a-z' |
     11   sort -n |
     12   join - <(cat /usr/share/dict/french | sort -n) |
     13   uniq -c |
     14   awk '{ c[$2] = $1; s += $1 }
     15     END {
     16       for (w in c) {
     17         f = c[w]/s;
     18         if (f < '$1' && f > '$2' && length(w) >= '$3') {
     19           printf "%s %d\n", w, 1/sqrt(f*10)
     20         }
     21       }
     22     }' |
     23   sort -k2,2n