Newer
Older
#!/bin/bash
prefix=$1
WORDSYMB_I="--isymbols=""$prefix""_dico_word.txt"
WORDSYMB_O="--osymbols=""$prefix""_dico_word.txt"
# 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"
# compilte exit and change section
cat "$prefix""_section0.txt" | fstcompile $WORDSYMB_I > "$prefix""_section0.basic.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""_exit.txt"| wc -l` == 0 ]
then
echo "Error: no $prefix""_section""$nbsect""_exit.txt file"
exit
fi
cat "$prefix""_section""$nbsect""_exit.txt" | fstcompile $WORDSYMB_I > "$prefix""_section""$nbsect"".exit.fst"
fstunion "$prefix""_section""$nbsect"".exit.fst" "$prefix""_section0.basic.fst" > "$prefix""_section""$nbsect"".exit.basic.fst"
if [ `cat "$prefix""_section""$nbsect"".txt" | wc -l` != 0 ]
then
cat "$prefix""_section""$nbsect"".txt" | fstcompile $WORDSYMB_I > "$prefix""_section""$nbsect"".fst2"
fstconcat "$prefix""_section""$nbsect"".fst2" "$prefix""_section""$nbsect"".exit.basic.fst" > "$prefix""_section""$nbsect"".fst4"
fstunion "$prefix""_section""$nbsect"".fst4" "$prefix""_section""$nbsect"".exit.basic.fst" > "$prefix""_section""$nbsect"".fst"
else
cp "$prefix""_section""$nbsect"".exit.basic.fst" "$prefix""_section""$nbsect"".fst"
rm -f "$prefix""_section""$nbsect"".exit.fst" -f "$prefix""_section""$nbsect"".exit.basic.fst" -f "$prefix""_section""$nbsect"".fst2" -f "$prefix""_section""$nbsect"".fst4"