plint

French poetry validator (local mirror of https://gitlab.com/a3nm/plint)
git clone https://a3nm.net/git/plint/
Log | Files | Refs | README

train_diaeresis.sh (1855B)


      1 #!/bin/bash
      2 
      3 # set -x
      4 
      5 DIR="$( cd "$( dirname "$0" )" && pwd )"
      6 cd "$DIR"
      7 cd .. # go in the main folder
      8 
      9 # use the verb diaeresis files if they exist
     10 if [ -f $DIR/diaeresis_verbs/final_syneresis -a -f $DIR/diaeresis_verbs/final_diaeresis ]
     11 then
     12   cat $DIR/diaeresis_verbs/final_syneresis | grep -vE -- '-vous$|-nous$' |
     13     python3 -m plint <(echo 12) \
     14     --diaeresis=$DIR/diaeresis_empty.json --ocontext=$DIR/final_syneresis.ctx\
     15     --weight=1 --offset=0
     16   cat $DIR/diaeresis_verbs/final_syneresis | grep -E -- '-vous$|-nous$' |
     17     python3 -m plint <(echo 12) \
     18     --diaeresis=$DIR/diaeresis_empty.json --ocontext=$DIR/final_syneresis2.ctx\
     19     --weight=1 --offset=1
     20   cat $DIR/final_syneresis.ctx $DIR/final_syneresis2.ctx | sponge $DIR/final_syneresis.ctx
     21   cat $DIR/diaeresis_verbs/final_diaeresis | grep -vE -- '-vous$|-nous$' |
     22     python3 -m plint <(echo 12) \
     23     --diaeresis=$DIR/diaeresis_empty.json --ocontext=$DIR/final_diaeresis.ctx\
     24     --weight=2 --offset=0
     25   cat $DIR/diaeresis_verbs/final_diaeresis | grep -E -- '-vous$|-nous$' |
     26     python3 -m plint <(echo 12) \
     27     --diaeresis=$DIR/diaeresis_empty.json --ocontext=$DIR/final_diaeresis2.ctx\
     28     --weight=2 --offset=1
     29   cat $DIR/final_diaeresis.ctx $DIR/final_diaeresis2.ctx | sponge $DIR/final_diaeresis.ctx
     30 fi
     31 
     32 # prepare the raw addition file
     33 for a in $DIR/additions $DIR/additions_quicherat $DIR/additions_cyrano
     34 do
     35   cut -d ' ' -f1 ${a}.txt > ${a}.tpl
     36   cut -d ' ' -f2- ${a}.txt > ${a}
     37 done
     38 
     39 # run the training
     40 FILES="andromaque mithridate boileau ../../train_diaeresis/additions ../../train_diaeresis/additions_quicherat cyrano$@"
     41 mkdir -p $DIR/contexts
     42 rm -f $DIR/contexts/*
     43 cp $DIR/diaeresis_empty.json $DIR/diaeresis0.json;
     44 for a in $(seq 0 4); do
     45   b=$(($a+1));
     46   $DIR/onepass.sh $a $DIR/diaeresis${a}.json $FILES > $DIR/diaeresis${b}.json;
     47 done;
     48 cat $DIR/diaeresis5.json