Skip to content
Snippets Groups Projects
compile_automate.sh 1.6 KiB
Newer Older
#!/bin/bash

prefix=$1

dir=`dirname $0`/../../../
export LD_LIBRARY_PATH=$dir/libs:$dir/libs/fst:$dir/libs/atlas:$PWD/src
export PATH=$dir/bin:$PATH

Benoit Favre's avatar
Benoit Favre committed
set -e -u -o pipefail

WORDSYMB_I="--isymbols=""$prefix""_dico_word.txt"
WORDSYMB_O="--osymbols=""$prefix""_dico_word.txt"

Benoit Favre's avatar
Benoit Favre committed
# compile tail
fstcompile $WORDSYMB_I $WORDSYMB_O "$prefix""_clean_tail.txt" > "$prefix""_clean_tail.fst"
# compile glouton
fstcompile $WORDSYMB_I "$prefix""_glouton.txt" > "$prefix""_glouton.fst"

cat "$prefix""_section0.txt" | fstcompile $WORDSYMB_I | fstunion - "$prefix""_glouton.fst" | fstclosure > "$prefix""_section0.fst"

nbsect=1
while [ "$nbsect" != 80 ]
do
 if [ -e "$prefix""_section""$nbsect"".txt" ]
 then
  rm -f "$prefix""_section""$nbsect".fst
  if [ `cat "$prefix""_section""$nbsect"".txt" | wc -l` != 0 ]
  then
   cat "$prefix""_section""$nbsect"".txt" | fstcompile $WORDSYMB_I > "$prefix""_section""$nbsect"".fst"
Benoit Favre's avatar
Benoit Favre committed
   cat "$prefix""_section0.txt" | fstcompile $WORDSYMB_I > "$prefix""_section""$nbsect"".fst.tmp"
   cat "$prefix""_section""$nbsect""_exit.txt" | fstcompile $WORDSYMB_I > "$prefix""_section""$nbsect"".fst.tmp"2
   fstunion "$prefix""_section""$nbsect"".fst.tmp" "$prefix""_section""$nbsect"".fst.tmp2" > "$prefix""_section""$nbsect"".fst.tmp4"
   fstconcat "$prefix""_section""$nbsect"".fst" "$prefix""_section""$nbsect"".fst.tmp4" > "$prefix""_section""$nbsect"".fst.tmp6"
   mv "$prefix""_section""$nbsect"".fst.tmp6" "$prefix""_section""$nbsect"".fst"
   rm -f "$prefix""_section""$nbsect"".fst.tmp" "$prefix""_section""$nbsect"".fst.tmp2" "$prefix""_section""$nbsect"".fst.tmp4"
Benoit Favre's avatar
Benoit Favre committed

 nbsect=$(($nbsect+1))
done
Benoit Favre's avatar
Benoit Favre committed