squelette

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

squelette.sh (1307B)


      1 #!/bin/bash
      2 # expects lexique as input
      3 # produces list as output
      4 
      5 cut -f1,4,8,5,14 - | grep '1$' | cut -f1,2,3,4 |
      6   grep NOM | grep -v "[ '-]" | grep -v '\.\s' | cut -f 1,3,4 |
      7   awk 'BEGIN {OFS = "\t"}
      8   {
      9     if ($2 == "f" || $2 == "m") {
     10       print $0;
     11     } else {
     12       print $1, "f", $2; print $1, "m", $2;
     13     };
     14   }' | sort -k3,3n |
     15   grep -vE `cat forbidden | grep -v '#' | tr '\n' '|' | sed 's/|$//'` \
     16     > noms_all
     17 cat noms_all | awk '$3 > 0' > noms
     18 
     19 curl 'https://a3nm.net/blog/french_gender_learning/leaves.txt' | cut -f 2 |
     20   tr -d ' ' | sed 's/./& /g' | cut -d ' ' -f2- | tr -d ' ' | sort |
     21   grep -v '^$' | uniq > ambig
     22 
     23 rm -f eval_raw
     24 pv -l ambig | while read l
     25 do 
     26   ./eval.sh "$l" 3 >> eval_raw
     27 done
     28 
     29 grep -v '0 0 [0-9]* [0-9]*$' eval_raw | awk '$5 > 2 && $7>20' |
     30   awk '{printf "%s %s %s %.5f\n", $1, $2, $3, $9* ($6/$5)*$4/($4+$5)}' |
     31   sort -k4,4rn | grep -v '^[ 0-9.bcdfghjklmnpqrstvwxzç]*$' > enigmes
     32 
     33 ./filter.py < enigmes | awk '$4 > 0.57' | cat - <(echo) | ./mkenigme.sh |
     34   sed '$d' > texte
     35 
     36 ./filter.py < enigmes | head -42 | cut -d ' ' -f1,3 |
     37   awk '{
     38       printf "%s %s\n",
     39               $2 == "f" ? "masculin" : "féminin ", $1
     40   }' > enigmes2
     41 
     42 cat enigmes2 |
     43   awk '{ printf "trouver un mot %s en -%s\n", $1, $2 }' > liste
     44 
     45 mkdir -p game
     46 
     47 ./makegame.sh < enigmes2