squelette

find exceptional genders for a noun ending
git clone https://a3nm.net/git/squelette/
Log | Files | Refs | README

eval.sh (905B)


      1 #!/bin/bash
      2 
      3 F=$(grep "$1\s[fm]" noms | grep '\sf\s' | awk 'BEGIN {s = 0} {s+=$3} END {print s}')
      4 M=$(grep "$1\s[fm]" noms | grep '\sm\s' | awk 'BEGIN { s = 0} {s+=$3} END {print s}')
      5 BF=$(grep ".$1\s[fm]" noms | grep '\sf\s' | sort -k3,3n | tail -$2 | awk 'BEGIN {s = 0} {s+=$3} END {print s}')
      6 BM=$(grep ".$1\s[fm]" noms | grep '\sm\s' | sort -k3,3n | tail -$2 | awk 'BEGIN {s = 0} {s+=$3} END {print s}')
      7 NF=$(grep "$1\s[fm]" noms | grep '\sf\s' | wc -l)
      8 NM=$(grep "$1\s[fm]" noms | grep '\sm\s' | wc -l)
      9 LLF=$(grep "$1\s[fm]" noms_all | grep '\sf\s' |
     10   awk '{print length($1)}' | sort -n | head -1)
     11 LLM=$(grep "$1\s[fm]" noms_all | grep '\sm\s' |
     12   awk '{print length($1)}' | sort -n | head -1)
     13 # caution: $LANG should be UTF
     14 LF=$(($LLF - ${#1}))
     15 LM=$(($LLM - ${#1}))
     16 V=$(bc <<< "$F > $M")
     17 if [ "$V" -eq 1 ]
     18 then
     19   echo "$1 $2 f $F $M $BM $NF $NM $LM"
     20 else
     21   echo "$1 $2 m $M $F $BF $NM $NF $LF"
     22 fi
     23