Des Mots Pour Souvenir

Ok. So, I’ve set up the hypertense-french program with a database of 230.  Here is the latest (much improved version) with statistics.  My sentences need quite a bit of editing in the files, but the program is pretty addictive (for me), and I want to put it down to concentrate on some other stuff.  The new version puts out a summary file with statistics called sommaire.out.  So, I did my testrun on 50 questions saying non to the avec paroles option, and listening to all 20 seconds of each song, and reading out loud the sentences when prompted.  This is what the output file looked like for me.

sommaire.out

Vous avez travailler  42 minutes pour une moyenne de:  0.84 minutes par question, et une somme de  50 questions.
Les verbes correctes ( 47 ): , fût, prenne, entendit, seront, aurai pensé, saurait, saurons, ai été, Voulu, voulait, est allée, fîmes, soit, a pu, aurai été, sois, avait été, pense, pourrait, tenues, vais, es, veuille, avait, eût, irai, sut, aurait eu, avait eu, Voulu, avait, aurons, fut, ai, tenait, voulaient, ai, dois, pouvait, irai, être, fasse, peux, tiens, tiens, voulais, penses
Les verbes avec fautes ( 3 ): , Prenant, prends, puis
La base de données avait  230 données.
Votre pourcentage est:  0.94

—————————————————————————————–

Hypertense-frenchtest.sh

#!/bin/bash
# hyper-tense-french.sh v.1.1 a program submitted by livedoggb on 4/18/2012
# dependencies compiled random1.c, frenchtestverbs directory with verb files as 02 avoir.txt … 11 finir.txt
# itunes directory named musique française with songs that you want to use sequentially numbered 01 …, 02 …, 03 … etc.
# itunes directory named frenchhighlit with audio tracks of the French quotes made by you named être01.avi, avoir33.avi, etc.
# with the number corresponding to the line number of the verb in the text file.
# It also outputs a file sommaire.out that has the statistics of your session.
dir_path=”/mnt/sdb1″
dir_txt_path=$( echo $dir_path/frenchtestverbs/ )
rm $dir_path/sommaire.out
#rm $dir_path/hyper-tense-files_used.out
sum_fautes=0
echo “Attendez pour quelques minutes pour que le systeme arrange la base de donnee de musique.”
if [ -e $dir_path/hyper-tense-french-time2.out ]
then
echo “Le programme a trouvé un fichier de temps.”
echo “1. Utilisez ce fichier.”
echo “2. En faire un nouveau fichier. Choisissez 2 si vous avez changé la musique.”
echo “Choisissez:  (Sí vous n´êtes pas sûr, choisissez 2.  Le default c´est 2.)”
read choice
else
choice=2
fi
if [ -e $choice ]
then
choice=”2″
fi
case “$choice” in
1)
echo “On utilise le vieux fichier.”
;;
2)
echo “On construit un autre fichier.  Ça prendra quelques minutes.”
echo “0” > $dir_path/hyper-tense-french-time2.out
mplayer -msglevel all=-1 -profile gnome-mplayer -ss 10 -endpos 1 -volume 0 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/musique\ française/*.* | tee temp.out | grep “^A: ” | sed -e ‘s/^A: .* of \([0-9]*\).* .*/\1/g’ >> $dir_path/hyper-tense-french-time2.out
;;
esac
time_array=($(cat $dir_path/hyper-tense-french-time2.out))
i=1
num_files=$(expr $(grep -c . $dir_path/hyper-tense-french-time2.out))

i=0
while [ $i -lt $num_files ]
do
echo “$i. ${time_array[$i]}”
i=$(( $i + 1 ))
done
num_files=$(( $num_files – 1 ))
echo “num_files=” $num_files
echo “Plusieurs options sont possibles.  Choisissez.”
echo “1.  Option Quiz (interactive).”
read choice
echo  “Avec parôles? Choisisez o ou n.  Default c´est non.”
read read_aloud
if [ -e $read_aloud ]
then
read_aloud=”n”
fi
case “$choice” in
2)
echo “Study/ housework mode.”
;;
1)
echo “Quiz mode.”
echo “Tout information derive de fichiers .txt dans le dossier frenchtestverb.”
c=””
right=0
asked=0
rightverbs=””
wrongverbs=””
average=0
verb_guess=””
num_vfiles=$(expr $(ls -1  $dir_txt_path/*.txt | grep -c . ))
hours_bgn=$( ‘date’| sed “s/.* \(..\):\(..\):\(..\).*/\1/”| sed “s/0\([0-9]\)/\1/” )
min_bgn=$( ‘date’| sed “s/.* \(..\):\(..\):\(..\).*/\2/”| sed “s/0\([0-9]\)/\1/” )
sec_bgn=$( ‘date’| sed “s/.* \(..\):\(..\):\(..\).*/\3/”| sed “s/0\([0-9]\)/\1/” )

while [ -e $c ]
do
random_verb_num=$( $dir_path/random1 1 $num_vfiles)
fn=$random_verb_num
#  echo “random_verb_num is:” $random_verb_num
verb=$(ls $dir_txt_path/$fn*.txt | sed “s/^.*$fn \(.*\).txt/\1/” )

if [ -e $dir_txt_path/$fn*.txt ]
then
maxlinenum=$( grep -c . $dir_txt_path/$fn*.txt)
maxlinenum=$(( $maxlinenum – 1 ))
quizfact=$( $dir_path/random1 1 $maxlinenum)
correctquizfact=$( echo “$quizfact”c)
omit_line=$( grep “^$correctquizfact:” $dir_txt_path/$fn*.txt)
#      echo “random quiz line is:” $quizfact $correctquizfact
if [ “$omit_line” != “” ]
then
echo “Le verbe c´est: ” $verb  “random quiz line is:” $quizfact
testline=$( grep “^$correctquizfact:” $dir_txt_path/$fn*.txt | sed -e “s/^.*STSENT:\(.*\)EVERB:.*/\1/”)
echo $testline
verb_guess=””
asked=$(( $asked + 1 ))
while [ -e $verb_guess ]
do
echo “Donnez le verbe correcte (mettez s pour en sortir):”
read verb_guess
done
if [ “$verb_guess” == “s” ]
then
break
fi
echo_verb=$( grep “^$correctquizfact:” $dir_txt_path/$fn*.txt | sed -e “s/^.*SVERB:\(.*\) STSENT:.*/\1/” )
if [ “$verb_guess” == “$echo_verb” ]
then
echo “Correcte.”
right=$(( $right + 1 ))
average=$(( $right/$asked ))
rightverbs=$( echo $rightverbs, $echo_verb)
num_mus=$( $dir_path/random1 1 $num_files )
num_mus_fixed=$(echo $num_mus | sed -e “s/^0//”)
prob_time=$(( ${time_array[$num_mus_fixed]} – 20 ))
ssx=($(expr $($dir_path/random1 0 $prob_time)))
mplayer -msglevel all=-1 -profile gnome-mplayer -ss $ssx -endpos 20 -volume 200 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/iTunes/iTunes\ Media/Music/musique\ française/$num_mus*.*

else
echo “Non.  La reponse correcte, c´est: ” $echo_verb
wrongverbs=$( echo $wrongverbs, $echo_verb )
fi

if [ $read_aloud == “o” ]
then
repeat=”o”
if [ -e /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/french\ highlit/$verb$quizfact.* ]
then
while [ $repeat == “o” ]
do
mplayer -volume 80 /mnt/sda1/Documents\ and\ Settings/TEMP/My\ Documents/My\ Music/french\ highlit/$verb$quizfact.*
echo “Ecrivez la phrase entendue sur du papier.  Repetez? (o ou n. default c´est non.)”
read repeat
if [ -e $repeat]
then
repeat=”n”
fi

done
echo
shighlit=$(grep “^$correctquizfact:” $dir_txt_path/$fn*.txt | sed -e “s/^.* SHIGHLIT:\(.*\)TRANSSHIGHLIT:.*/\1/”)
echo $shighlit
echo
echo Comptez les fautes dans ce que vous aviez écrit. Un point pour châque mot.
echo Quel est le nombre de fautes?
read fault_number
if [ -e $fault_number ]
then
fault_number=0
fi
sum_faults=$(( $sum_faults + $fault_number ))
fi
fi
trans_sent=$(grep “^$correctquizfact:” $dir_txt_path/$fn*.txt | sed -e “s/^.*ETSENT1:\(.*\)ETSENT2:.*/\1/”)
#
echo
shighlit=$(grep “^$correctquizfact:” $dir_txt_path/$fn*.txt | sed -e “s/^.* SHIGHLIT:\(.*\)TRANSSHIGHLIT:.*/\1/”)
echo $shighlit
echo
echo “Maintenant, finissez par lire à haute voie la ligne au-dessus.”
read
echo “numero de la ligne c´est:” $quizfact
echo $testline | sed “s/.*(\(.*\)).*/\1/”
echo $testline | sed “s/(.*)/$echo_verb/”
echo $trans_sent
aver_right=$( $dir_path/intdiv2float $right $asked | sed -e “s/\([0-9]*\…\).*/\1/” )
echo $right “/” $asked ” correcte.  Batting average:” $aver_right “Fautes de dictation: ” $sum_faults
echo “Attendez…je cherche une autre exemple…”
fi
fi
done
hours_end=$( ‘date’| sed “s/.* \(..\):\(..\):\(..\).*/\1/”| sed “s/0\([0-9]\)/\1/” )
min_end=$( ‘date’| sed “s/.* \(..\):\(..\):\(..\).*/\2/”| sed “s/0\([0-9]\)/\1/” )
sec_end=$( ‘date’| sed “s/.* \(..\):\(..\):\(..\).*/\3/”| sed “s/0\([0-9]\)/\1/” )
hours_diff=$(( $hours_end – $hours_bgn ))
min_diff=$(( $min_end – $min_bgn ))
sec_diff=$(( $sec_end – $sec_bgn ))
midnight=12
if [ $hours_diff -lt 0 ]
then
hours_diff=$(( $(( $midnight – $hours_bgn )) + $hours_end ))
# fix hour change if it happens at midnight or noon,
fi
time_of_ans=$(( $hours_diff * 60 + $min_diff ))
aver_time=$( $dir_path/intdiv2float $time_of_ans $((asked – 1)) | sed -e “s/\([0-9]*\…\).*/\1/” )

echo “Vous avez travailler ” $time_of_ans “minutes pour une moyenne de: ” $aver_time “minutes par question, et une somme de ” $(($asked – 1)) “questions.” | tee >>sommaire.out
echo “Les verbes correctes (” $right “):” $rightverbs  | tee >>sommaire.out
wrong=$(( $asked – $right – 1 ))
echo “Les verbes avec fautes (” $wrong “):” $wrongverbs | tee >>sommaire.out
num_entries=$(grep “^[0-9]*c:” $dir_txt_path/*.txt | grep -c .)
echo “La base de données avait ” $num_entries “données.” | tee >>sommaire.out
echo “Votre pourcentage est: ” $aver_right | tee >>sommaire.out
cat sommaire.out
;;
3)
echo “Mode 3”

;;
esac

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s