plint

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

onepass.sh (856B)


      1 #!/bin/bash
      2 
      3 # read current diaeresis file as $2 and take unique prefix as $1
      4 # produce on stdout new diaeresis file
      5 
      6 # set -x
      7 
      8 DIR="$( cd "$( dirname "$0" )" && pwd )"
      9 cd "$DIR"
     10 cd .. # go in the main folder
     11 
     12 NUM="$1"
     13 DFILE="$2"
     14 shift
     15 shift
     16 
     17 mkdir -p $DIR/contexts
     18 
     19 # use the verb diaeresis files if they exist
     20 if [ -f $DIR/diaeresis_verbs/final_syneresis -a -f $DIR/diaeresis_verbs/final_diaeresis ]
     21 then
     22   cp $DIR/final_syneresis.ctx "$DIR/contexts/final_syneresis.$NUM"
     23   cp $DIR/final_diaeresis.ctx "$DIR/contexts/final_diaeresis.$NUM"
     24 fi
     25 
     26 for f in "$@"
     27 do
     28   NAME=$(basename "./plint/test_data/$f")
     29   DEST="$DIR/contexts/$NAME.$NUM"
     30   python3 -m plint ./plint/test_data/$f.tpl \
     31     --diaeresis=$DFILE --ocontext="$DEST" < ./plint/test_data/$f
     32 done
     33 cd haspirater/
     34 cat $DIR/contexts/* | ./haspirater/buildtrie_list.py |
     35   ./haspirater/compresstrie.py
     36