Library

Trying to get all the code pretty debugged.  I’ve got all 4 programs plus a 30MB picture dir for the kids down to 688MB which will fit on a single 700MB read-only CD that I could burn for the kids.  It also has the linux operating system which would boot by default from the CD, and a Firefox browser.  I have to say, if it were me, as a parent, I would put this on a computer that does not have internet access for kids.  I could burn a second one without the pictures of the kids’ trip for the library, put it in a cover with a little help file to get people started, and people could check it out and copy it.

I’ve got a maps option up and running on the write_words program (the only program that I am still developing right now – the other kid’s programs are in their final version).  I’d like to have a few more sound files and get some more language options running.  I’ve tried using the lang_pack_all-0.9.sfs pet to add some more languages.  It does improve the menus, and reverse the screen so that the startup menu is on the right for the Hebrew version, but actually seems to complicate reading files into and saving multilingual files back out of the editor.  The code is not really 100% there in this pet, but it is useful for learning the words for computer programming in different languages like “open” “quit” “save” “keyboard” “file” etc.

I added a Norwegian language file, but again, I’m having problems getting the ø (o slash), æ (ae ligature), and å (a ring) to print to the screen in the program, although they look fine in the editor file.  Conclusion: the x-server default font (I presume set with the language) does not have access to the same font file as the editor does.  Although the program probably reads the file correctly, it cannot print to screen the character.  I guess grepping a ligature word would test this.  It should match and pass, but not be able to display the word.  Kind of like a printer problem.  There is no glory in solving font problems…

Update:  Norwegian problem resolved.  There was a little bug in the selection criteria for the font, and I wasn’t selecting in the code.  Everything displays correctly now in Norwegian.

The Greek does not display pi or omega.  Actually, it gets pi in black and white, but still does not get omega.

Still working on the Hebrew.  Shin displays in black and white, but not color, so all letters are technically available without points (vowels).  Interestingly, a shell script that has a double echo on a quoted Hebrew word will reverse it, but this does not work with a variable, so this trick can’t be used in the main program.  So, part of the problem seems to be specifically in the way echo writes.  I wrote the c program to reverse the word, and pipe the noun through the program.  Works in a generic shell script with English, but not Hebrew without getting some additional characters before and after the word.  I’ve tried adding characters to the string, and using selection criteria to pull out the middle since these are end effects.  Still not working.  One version, when I put it in my write_words program, and recall the noun, is blank…  I think that version is hitting the null character at the end of the string.  Trying to reformulate the c code.

Update:  I’ve got the code working with about 1/2 of the 25 Hebrew words in the Hebrew file.  Some letter combinations such as  שנה (the Hebrew word for year) do not seem to work even if embedded in other characters.  I have not been able to solve this problem (is it 1/2 spaces?  Specifically, the he or ה does not display with the word – another couple of letters display (maybe a hidden reverse word signal?).  The ה does display in other words.  שם (the Hebrew word for place) is also problematic.  I’m posting a version of the code at the bottom of the page, along with the Hebrew word file (the lines commented with c work.  There is a little clue to work with in that the hebrew word for rooms is backwards from all the others, although it is inverting, it is being read differently.)  I’ve also tried saving the words to a file, and reading them back in using cat.  Not sure if that is this version of the code.  If it is, it won’t burn because the file is local.  A path will have to be reset.  In any event, it did not help.  I’ve commented out the map reading lines.  Although fun, they are hard to work with when debugging, but they are there.  Just comment them back in in the script.  Also, a Swahili language option is now available (for the moment without sound), but I will eventually fix this.

Otherwise, thinking about some new salvage wheels with better mpgs, mentally mapping out adventures with a little less heat, and I’ve spent a couple of hours this AM doing laundry.  There’s a machine, but it stopped working after it filled up.  It was really heavy to move, but after checking fuses, outlets, and finally porting the heavy stuff out to the line wet, it started again.  It reminded me of Arkansas, and having to do laundry when it rained enough to fill up the bucket.  Not the end of the world, but it’s an adjustment…

The Hebrew word file:

nouns
01: year  ENG: שנה (f) SENT: In the  _______ 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
02: degree  ENG:תואר  (m) SENT: In the year 1878 I took my ________ of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
03c: Doctor  ENG: וקטור  (m) SENT: In the year 1878 I took my degree of  ________ of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
04c: Medicine  ENG: רפואה  (f) SENT: In the year 1878 I took my degree of Doctor of ________ of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
05: University  ENG:אוניברסיטה  (f) SENT: In the year 1878 I took my degree of Doctor of Medicine of the _________ of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
06c: course  ENG: כמובן  (m) SENT: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the ________ prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
07: surgeons  ENG: מנתחים  (m) SENT: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for __________ in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
08: army  ENG:עבא  (f) SENT: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the ________. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: In the year 1878 I took my degree of Doctor of Medicine of the University of London, and proceeded to Netley to go through the course prescribed for surgeons in the army. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
09: shoulder  ENG:כתך  (f) SENT: There I was struck on the ________ by a Jezail bullet, which shattered the bone and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP:  There I was struck on the shoulder by a Jezail bullet, which shattered the bone and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
10c: bullet  ENG: כדור  (f) SENT: There I was struck on the shoulder by a Jezail ________, which shattered the bone and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP:  There I was struck on the shoulder by a Jezail bullet, which shattered the bone and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
11: bone  ENG: עצם  (m) SENT: There I was struck on the shoulder by a Jezail bullet, which shattered the _________ and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP:  There I was struck on the shoulder by a Jezail bullet, which shattered the bone and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
12: artery  ENG: עורק  (f) SENT: There I was struck on the shoulder by a Jezail bullet, which shattered the bone and grazed the subclavian _________.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP:  There I was struck on the shoulder by a Jezail bullet, which shattered the bone and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
13: There  ENG:שם  (f) SENT: __________ I was struck on the shoulder by a Jezail bullet, which shattered the bone and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP:  There I was struck on the shoulder by a Jezail bullet, which shattered the bone and grazed the subclavian artery.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
14: kin  ENG:משמפחה  (f) SENT: I had neither kith nor _____ in England, and was therefore as free as air-or as free as an income of eleven shillings and sixpence a day will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: I had neither kith nor kin in England, and was therefore as free as air-or as free as an income of eleven shillings and sixpence a day will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
15c: air  ENG: אויר  (m) SENT: I had neither kith nor kin in England, and was therefore as free as ______-or as free as an income of eleven shillings and sixpence a day will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: I had neither kith nor kin in England, and was therefore as free as air-or as free as an income of eleven shillings and sixpence a day will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
16c: income  ENG: הכנסה  (f) SENT: I had neither kith nor kin in England, and was therefore as free as air-or as free as an ______ of eleven shillings and sixpence a day will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: I had neither kith nor kin in England, and was therefore as free as air-or as free as an income of eleven shillings and sixpence a day will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
17: day  ENG:יום  (m) SENT: I had neither kith nor kin in England, and was therefore as free as air-or as free as an income of eleven shillings and sixpence a _________ will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: I had neither kith nor kin in England, and was therefore as free as air-or as free as an income of eleven shillings and sixpence a day will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
18: man  ENG:אדם  (m) SENT: I had neither kith nor kin in England, and was therefore as free as air-or as free as an income of eleven shillings and sixpence a day will permit a ________ to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: I had neither kith nor kin in England, and was therefore as free as air-or as free as an income of eleven shillings and sixpence a day will permit a man to be.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
19c: sight  ENG: הופעה  (f) SENT: The _______ of a friendly face in the great wilderness of London is a pleasant thing indeed to a lonely man. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: The sight of a friendly face in the great wilderness of London is a pleasant thing indeed to a lonely man. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
20c: face  ENG: פנים  (m) SENT: The sight of a friendly _________ in the great wilderness of London is a pleasant thing indeed to a lonely man. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: The sight of a friendly face in the great wilderness of London is a pleasant thing indeed to a lonely man. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
21c: wilderness  ENG: שממה  (f) SENT: The sight of a friendly face in the great ___________ of London is a pleasant thing indeed to a lonely man. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: The sight of a friendly face in the great wilderness of London is a pleasant thing indeed to a lonely man. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
22: thing  ENG: דבר  (f) SENT: The sight of a friendly face in the great wilderness of London is a pleasant _________ indeed to a lonely man. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: The sight of a friendly face in the great wilderness of London is a pleasant thing indeed to a lonely man. (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
23c: problem  ENG: בעיה  (m) SENT: I’m trying to solve the _________ as to whether it is possible to get comfortable rooms at a reasonable price.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: I’m trying to solve the problem as to whether it is possible to get comfortable rooms at a reasonable price.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
24c: rooms  ENG: חדרים  (f) SENT: I’m trying to solve the problem as to whether it is possible to get comfortable ___________ at a reasonable price.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: I’m trying to solve the problem as to whether it is possible to get comfortable rooms at a reasonable price.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)
25c: price  ENG: מחיר  (m) SENT: I’m trying to solve the problem as to whether it is possible to get comfortable rooms at a reasonable _________.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle) SENTCOMP: I’m trying to solve the problem as to whether it is possible to get comfortable rooms at a reasonable price.  (A Case in Scarlet, p. 13, Sir Arthur Conan Doyle)

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

The rev_str2.c code:  (this is admittedly pretty embarrassing, but it works!)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
MAX_ALLOWED=10000;

#include <stdio.h>

int main(int argc, char *argv[1], char *envp[]) {
char *a, input_str[200] , input_str2[200], is[201];
char *output_str;
int i, j=0, size;

size=strlen(argv[1]);
strncpy(input_str, argv[1], size );
strcat(input_str, “מ”);
/*  strcat( input_str,input_str);
printf(“%s\n”,input_str);
printf(input_str);   */
size=strlen(input_str);
for (i=(size-1);i>0;i–){
input_str2[j]=input_str[i];
/* a=*(input_str2+j);
printf(“%c\n”,   *a );  */

j++;
};
/*  input_str2[0]=input_str[size];
input_str2[size]=NULL;
strncpy(input_str, argv[1], size );   */
printf(“%s\n”,input_str2);
/*  printf(input_str2);  */
return 0;
}
————————————————————————————————–

#!/bin/bash
# write_words_spanish_queensenglish.sh v.1.2 a program submitted by livedoggb on June 8/2012
# dependencies compiled random1.c, and intdiv2float.c and language directories like french-queensenglishtestnouns and/or spanish-queensenglishtestnouns directories
# with noun files called 01 spanish-queensenglish-Dickens-nouns1.txt, 02 spanish-queensenglish-Blake-nouns2.txt and/or 01 french-queensenglish-Dickens-nouns1.txt,
# 02 french-queensenglish-Blake-nouns2.txt in their appropriate directories
# itunes directory named spanish-queensenglish music or french-queensenglish music with songs that you want to use sequentially numbered 01 …, 02 …, 03 … etc.
# itunes directory named spanish-queensenglish highlit or french-queensennglish music with audio tracks of the queensenglish quotes made by you named french-queensenglish-01nouns01.avi, or spanish-queensenglish-01nouns01.avi, spanish-queensenglish-01nouns33.avi, etc.
# with the number corresponding to the line number of the noun in the text file.
# the number of files in each of the language directories must be the same right now.  The Spanish one is reference.
# It also outputs a file sommaire.out that has the statistics of your session.

mnt_path=”/mnt/sdb1/”
dir_path=”$mnt_path/for_kids/write_words_program/”
temp_path=”/root/”
temp_file=”$temp_path/temp.out”
dir_cprog=$( echo “$mnt_path/for_kids/c_progs/” )

function trim_line {
i=1
echo
#num_words=$(gawk ‘{ sum += $1 }; END { print sum }’ testline.out)
words_left=”c”
while [ “$words_left” != “” ]
do
j=$(( $i + 8 ))
words_left=$( echo $line | cut -d’ ‘ -f$i-$j )
echo $words_left
i=$(( $j + 1 ))
done
return
}

function read_sentence_outloud {
if [ “$read_aloud” == “y” ]
then
repeat=”y”
sp=$( echo $sound_path2/”$random_verb_num”_”$language2″_full_quotes/”$quizfact”_*.* )
echo “directory path is: ” $sp
if [ -e “$sp” ]
then
while [ “$repeat” == “y” ]
do

#< /dev/null &
shighlit=$(grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.* SENTCOMP:\(.*\).*/\1/”)
line=$shighlit
#                    trim_line
echo
echo “Press enter when you are ready to hear the sentence read aloud.”
read ready
mplayer -volume 80 “$sp”
if [ $act == “read” ]
then
trim_line
verb_guess=””
asked=$(( $asked + 1 ))

echo “Read the sentences that you heard.  Repeat? (y or n. The default is n.)”
else
verb_guess=””
asked=$(( $asked + 1 ))

echo “Write the sentences that you heard.  Repeat? (y or n. The default is n.)”
fi
read repeat
if [ -e “$repeat” ]
then
repeat=”n”
fi
done
fi
fi
return
}

function show_the_sentence {
l1=$( echo $language1 | sed -e “s/kids-//” )
echo -n “The $l1 noun is: ”
echo_in_color_noun_w_gender  “random quiz line is:” $quizfact
line=$testline
verb_guess=””
asked=$(( $asked + 1 ))
if [ “$act” == “read” ]
then
trim_line

fi
while [ -e $verb_guess ]
do
l2=$( echo $language2 | sed -e “s/kids-queens//” )
echo “Enter the $l2 form of the noun (enter e to exit):”
read verb_guess
done
if [ “$verb_guess” == “e” ]
then
break
fi
echo_verb=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^[0-9]*c: \(.*\)  ENG: \(.*\) (.) SENT: .*/\1/” )

if [ “$verb_guess” == “$echo_verb” ]
then
echo “Correct.”
right=$(( $right + 1 ))
average=$(( $right/$asked ))
rightverbs=$( echo $rightverbs, $echo_verb)
num_mus=$( $dir_cprog/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_cprog/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/$language1-$language2\ music/$num_mus*.*

else

echo “No.  The correct response is: ”  $echo_verb
echo   “random quiz line is:” $quizfact

wrongverbs=$( echo $wrongverbs, $echo_verb )
fi

echo
return
}

function read_clueword_outloud {
if [ “$read_aloud” == “y” ]
then
repeat=”y”
sp=$( echo $sound_path1/”$random_verb_num”_”$language1″_sound/”$quizfact”_nouns_”*.*” )
echo “directory path is: ” $sp
ls $sp
if [ -e $sp ]
then
while [ “$repeat” == “y” ]
do

#< /dev/null &
#                    shighlit=$(grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.* SENTCOMP:\(.*\).*/\1/”)
#                    line=$shighlit
#                    trim_line
#                    echo
#                    echo “Press enter when you are ready to hear the foreign word read aloud.”
#                    read ready
mplayer -volume 80 $sp
#                    trim_line
l1=$( echo $language1 | sed -e “s/kids-//” )
echo “Write on a separate piece of paper, and repeat aloud the $l1 word that you heard.  Repeat? (y or n. The default is n.)”
read repeat
if [ -e “$repeat” ]
then
repeat=”n”
fi
done
echo -n “The word is: ”
echo_in_color_noun_w_gender
echo
echo -n “Did you write it down correctly? (y or n)”
read $mistake
if [ -e “$mistake” ]
then
mistake=0
fi
case “$mistake” in
default)
mistake=0
;;
“y”)
mistake=0
;;
“yes”)
mistake=0
;;
“n”)
mistake=1
;;
“no”)
mistake=1
;;
esac
sum_mistakes=$(( $sum_mistakes + $(( $mistake )) ))
fi
fi
return
}

function read_englishword_outloud {
if [ “$read_aloud” == “y” ]
then
repeat=”y”
sp=$( echo “$sound_path2″/”$random_verb_num”_”$language2″_sound/”$quizfact”_”*.*” )
echo “directory path is: ” $sp
if [ -e $sp ]
then
while [ “$repeat” == “y” ]
do

#< /dev/null &
#                    shighlit=$(grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.* SENTCOMP:\(.*\).*/\1/”)
#                    line=$shighlit
#                    trim_line
#                    echo
l1=$( echo $language1 | sed -e “s/kids-//” )
l2=$( echo $language2 | sed -e “s/kids-queens//” )
#                    echo “Press enter when you are ready to hear the $l2 word read aloud.”
#                    read ready
mplayer -volume 80 $sp
#                    trim_line

echo -n “The word in the $l1 language you are studying is: ”
echo_in_color_noun_w_gender
echo

echo “Write on a separate piece of paper and repeat aloud the $l2 word that you heard.  Repeat? (y or n. The default is n.)”
read repeat
if [ -e “$repeat” ]
then
repeat=”n”
fi
done
l1=$( echo $language1 | sed -e “s/kids-//” )
#              echo -n “The word in the $l1 language you are studying is: ”
#              echo_in_color_noun_w_gender
echo
echo -n “The word in $l2 you are studying is: ”
engnoun=$( grep “^$correctquizfact:” “$dir_txt_path2″/$fn*.txt | sed -e “s/^.*c:\(.*\)  ENG:.*/\1/” )
echo $engnoun
echo
echo -n “Did you write it down correctly? (y or n)”
read $mistake
if [ -e “$mistake” ]
then
mistake=0
fi
case “mistake” in
default)
mistake=0
;;
“y”)
mistake=0
;;
“yes”)
mistake=0
;;
“n”)
mistake=1
;;
“no”)
mistake=1
;;
esac
sum_mistakes=$(( $sum_mistakes + $(( $mistake )) ))
fi
fi
return
}

function echo_in_color_noun_w_gender {
l=$( echo $language | sed -e “s/kids-//” )
case $l  in
default)
LANG=es_ES.UTF-8
;;
“german”)
LANG=de_DE.UTF-8
;;
“greek”)
LANG=el_GR.UTF-8
;;
“hebrew”)
LANG=he_IL.UTF-8
n2=$( echo $noun | sed -e “s/(.)//” )
#      echo $n2
#      $dir_cprog/rev_str2  $n2  > revheb
#      cat revheb
#      read
# echo $( echo $n2 )

#      a=$( echo $(echo “צלחן”) )
#     echo $a
#      n2=$( echo $noun | sed -e “s/  (.) //” )
#     echo $n2
#     n3=$( $dir_cprog/rev_str2 “$n2” )
#     echo $( echo “$n3″ )
# n2=”שדךגלחכי”
echo   $( /mnt/sdb1/for_kids/c_progs/rev_str2 $n2 )
#    rnoun=$( echo $n3 )
#     noun=$rnoun
;;
“norwegian”)
LANG=nn_NO
;;
esac

color=$( grep “^$correctquizfact:” $dir_txt_path1/$fn*.txt | sed -e “s/^[0-9]*c:\(.*\)ENG: \(.*\) *(\(.\)) *SENT:.*/\3/” )
case “$color” in
“m”)
echo -e ‘\E[47;34m'”33[1m$noun33[0m”
;;
“f”)
echo -e ‘\E[47;31m'”33[1m$noun33[0m”
;;
“n”)#0CF82B
echo -e ‘\E[47;42m'”33[1m$noun33[0m”
;;
esac
LANG=es_ES.UTF-8
tput sgr0
return
}
function select_language2 {
lang_picked=”notpicked”
while [ $lang_picked == “notpicked” ]
do
echo “Available reader languages are:”
echo  1. English
echo
echo -n “Enter a number:”
read lang_num
if [ “$lang_num” -gt 6 ]
then
echo “Language not yet available.  Pick another one. ”
fi
case “$lang_num” in
1)
language=”kids-queensenglish”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
default)
language=”kids-queensenglish”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
esac
done
language2=$language
l2=$( echo $language2 | sed -e “s/kids-queens//” )
#    echo “This is a map of where ” $l2 “is spoken in the world.”
#    viewnior “$dir_path”/maps/”$l2″.png < /dev/null &
return
}

function select_language1 {
lang_picked=”notpicked”
while [ $lang_picked == “notpicked” ]
do
echo “Available clue languages are:”
echo  1. French
echo  2. German
echo  3. Spanish
echo  4. Italian
echo  5. Portuguese
echo  6. Greek
echo  7. Hebrew
echo  8. Arabic
echo  9. Farsi
echo 10. Syriac
echo 11. Chinese
echo 12. Russian
echo 13. Polish
echo 14. Irish
echo 15. Norwegian
echo 16. Dutch
echo 17. Hindi
echo 18. Urdu
echo 19. Sanskrit
echo 20. Swahili
echo
echo -n “Enter a number:”
read lang_num
#    if [ “$lang_num” -gt 6 ]
#       then
#         echo “Language not yet available.  Pick another one. ”
#    fi

case “$lang_num” in
1)
language=”kids-french”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
2)
language=”kids-german”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
3)
language=”kids-spanish”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
4)
language=”kids-italian”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
5)
language=”kids-portuguese”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
6)
language=”kids-greek”
lang_picked=”picked”
LANG=es_ES.UTF-8
;;
7)
language=”kids-hebrew”
lang_picked=”picked”
;;
8)
language=”kids-arabic”
lang_picked=”picked”
;;
9)
language=”kids-farsi”
lang_picked=”picked”
;;
10)
language=”kids-syriac”
lang_picked=”picked”
;;
11)
language=”kids-chinese”
lang_picked=”picked”
;;
12)
language=”kids-russian”
lang_picked=”picked”
;;
13)
language=”kids-polish”
lang_picked=”picked”
;;
14)
language=”kids-irish”
lang_picked=”picked”
;;
15)
language=”kids-norwegian”
lang_picked=”picked”
;;
16)
language=”kids-dutch”
lang_picked=”picked”
;;
17)
language=”kids-hindi”
lang_picked=”picked”
;;
18)
language=”kids-urdu”
lang_picked=”picked”
;;
19)
language=”kids-sanskrit”
lang_picked=”picked”
;;
20)
language=”kids-swahili”
lang_picked=”picked”
;;
default)
language=”kids-spanish”
lang_picked=”picked”
;;
esac
language1=$language
l1=$( echo $language1 | sed -e “s/kids-//” )
#    echo “This is a map of where ” $l1 “is spoken in the world.”
#    viewnior “$dir_path”/maps/”$l1”.png < /dev/null &
done

return
}

function set_paths {
#clue language is lang1
#reading language is lang2

lang2=$( echo “$language2″testnouns)
tvf2=$( echo “$lang2”)
dir_txt_path2=$( echo “$dir_path”/$tvf2/$lang2 )
tvs2=$( echo “$tvf2″_sound )

lang1=$( echo “$language1”-“$lang2”)
tvf1=$( echo “$lang1”)
dir_txt_path1=$( echo “$dir_path”/$lang2/$tvf1/ )
tvs1=$( echo “$tvf1″_sound )
sound_path1=$( echo “$dir_path”/$tvs2/”$language1″_sound_nouns/ )
sound_path2=$( echo “$dir_path”/$tvs2/”$language2″_sound_nouns/ )

#echo “Clue working language path is: ” $dir_txt_path1
#ls $dir_txt_path1
#echo “Reading working language path is: ” $dir_txt_path2
#ls $dir_txt_path2
#echo “Clue working sound path is: ” $sound_path1
#ls $sound_path1
#echo “Reading working sound path is: ” $sound_path2
#ls $sound_path2

return
}

clear
select_language2
select_language1
set_paths

if [ -e $temp_path/sommaire.out ]
then
rm $temp_path/sommaire.out
fi
#rm $dir_path/hyper-tense-files_used.out
sum_fautes=0
if [ -e $dir_path ]
then
echo “directory path passed.”
else
echo “directory path not valid.  Your USB device might be mounted under a different name.  Reset path on line 11 and start over.”
read
fi
echo “Please wait for a few minutes while the system sets up the music database.”
if [ -e $temp_path/$language-time2.out ]
then
echo “The program has found a time file.”
echo “1. Use this file.”
echo “2. Make a new time file. Choose 2 if you have changed the music.”
echo “Please choose:  (If you aren´t sure, choose 2.  The default is 2.)”
read choice
else
echo “0” > $temp_path/$language-time2.out
choice=2
fi
if [ -e $choice ]
then
choice=2
fi

case $choice in
1)
echo “Using the old file.”
;;
2)
echo “Making another file.  This will take a few minutes.  Please be patient.”
if [ -e $temp_path/$language-time2.out ]
then
rm $temp_path/$language-time2.out
fi
echo “0” > $temp_path/$language-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/$language1-$language2\ music/*.* | tee “$temp_file” | grep “^A: ” | sed -e ‘s/^A: .* of \([0-9]*\).* .*/\1/g’ >> $temp_path/$language-time2.out
;;
esac

time_array=($(cat $temp_path/$language-time2.out))
i=1
num_files=$(expr $(grep -c . $temp_path/$language-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

echo “Several options are possible.  Please choose a level (enter a number between 1 and 6).”
echo
echo “Level 1.  Find the word.”
echo “Level 2.  Write the $l1 language word that you hear.”
echo “Level 3.  Write the $l2 word that you hear.”
echo “Level 4.  Read the sentence after listening to it.”
echo “Level 5.  Write the sentence after listening to it.”
echo “Level 6.  Quiz mode – Just the word and music.”
echo “Level 7.  Quiz mode – comprehensive.”
echo
echo -n “Level?”
read choice
echo  “With oral reading? Choose y or n.  Default is n.”
read read_aloud
if [ -e $read_aloud ]
then
read_aloud=”n”
fi

case “$choice” in
1)
echo “Level 1.”
echo “Find the word.”
;;
2)
echo “Level 2.”
echo “Write the $language1 word that you hear.”
sum_mistakes=0
;;
3)
echo “Level 3.”
echo “Write the $language2 word that you hear.”
sum_mistakes=0
;;
4)
echo “Level 4.”
echo “Read the sentence after listening to it.”
;;
5)
echo “Level 5.”
echo “Write the sentence after listening to it.”
;;
6)
echo “Level 6.”
echo “Quiz mode – just the word and music.”
;;
7)
echo “Level 7.”
echo “Quiz mode – comprehensive.”
;;
esac

echo “All information derives from .txt files in the folder ” $dir_txt_path
language_primer=$( echo $dir_txt_path2 )
c=””
right=0
asked=0
rightverbs=””
wrongverbs=””
average=0
verb_guess=””
num_vfiles=$(expr $(ls -1  $dir_txt_path2/*.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_cprog”/random1 1 $num_vfiles)
fn=$random_verb_num
echo “random_verb_num is:” $random_verb_num
verb=$(ls $dir_txt_path1/$fn*.txt | sed “s/^.*$fn \(.*\).txt/\1/” )
if [ -e “$dir_txt_path1″/$fn*.txt ]
then
maxlinenum=$( grep -c . $dir_txt_path1/$fn*.txt)
maxlinenum=$(( $maxlinenum – 1 ))
quizfact=$( “$dir_cprog”/random1 1 $maxlinenum)
correctquizfact=$( echo “$quizfact”c)
omit_line=$( grep “^$correctquizfact:” “$dir_txt_path1″/$fn*.txt)
#      echo “random quiz line is:” $quizfact $correctquizfact
if [ “$omit_line” != “” ]
then
noun=$( grep “^$correctquizfact:” “$dir_txt_path1″/$fn*.txt | sed -e “s/^.* ENG: \(.*\) SENT:.*/\1/” )
case $choice in
default)
echo “Not a valid choice.”
exit
;;
1)
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*SENTCOMP:\(.*\)/\1/” )
act=”read”
show_the_sentence
read_sentence_outloud
;;
2)
read_clueword_outloud
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*SENT:\(.*\)SENTCOMP:.*/\1/”)
act=”read”
show_the_sentence
read_sentence_outloud
;;
3)
read_englishword_outloud
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*SENT:\(.*\)SENTCOMP:.*/\1/”)
act=”read”
show_the_sentence
read_sentence_outloud
;;
4)
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*SENTCOMP:\(.*\)/\1/” )
act=”read”
#show_the_sentence
read_sentence_outloud
;;
5)
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*SENTCOMP:\(.*\)/\1/” )
act=”write”
read_sentence_outloud
act=”read”
show_the_sentence
trim_line
echo “Count the number of mistakes in what you wrote. One point for every word.”
echo How many errors?
read fault_number
if [ -e $fault_number ]
then
fault_number=0
fi
sum_faults=$(( $sum_faults + $fault_number ))
;;
6)
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*SENTCOMP:\(.*\)/\1/”)
show_the_sentence
;;
7)
read_clueword_outloud
testline=$( grep “^$correctquizfact:” $language_primer/$fn*.txt | sed -e “s/^.*SENTCOMP:\(.*\)/\1/” )
show_the_sentence
act=”write”
read_sentence_outloud
act=”read”
show_the_sentence
trim_line
echo “Count the number of mistakes in what you wrote. One point for every word.”
echo How many errors?
read fault_number
if [ -e $fault_number ]
then
fault_number=0
fi
sum_faults=$(( $sum_faults + $fault_number ))
;;
esac

#show_the_sentence

fi
fi
#trans_sent=$(grep “^$correctquizfact:” $dir_txt_path/$fn*.txt | sed -e “s/^.*SENTCOMP:\(.*\)/\1/”)
#
#shighlit=$(grep “^$correctquizfact:” $language_primer/$fn*.txt | sed -e “s/^.* SENTCOMP:\(.*\).*/\1/”)
#line=$shighlit
#trim_line

#echo “Please finish by reading the above sentence out loud.”
#read
echo “The line number is:” $quizfact
#echo $testline | sed “s/.*(\(.*\)).*/\1/”
#echo $testline | sed “s/(.*)/$echo_verb/”
#echo $trans_sent
echo $echo_verb
aver_right=$( $dir_cprog/intdiv2float $right $asked | sed -e “s/\([0-9]*\…\).*/\1/” )
echo $right “/” $asked ” correct.  Batting average:” $aver_right “Dictation errors: ” $sum_faults “Mistakes: ” $sum_mistakes
echo “Please wait while I look for another question…”
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_cprog/intdiv2float $time_of_ans $((asked – 1)) | sed -e “s/\([0-9]*\…\).*/\1/” )
echo “You worked ” $time_of_ans “minutes for an average of: ” $aver_time “minutes per question, and a sum of ” $(($asked – 1)) “questions with ” $sum_mistakes ” mistakes and ” $sum_faults “dictation faults.” | tee >> $temp_path/sommaire.out
echo “The correct nouns (” $right “):” $rightverbs  | tee >>$temp_path/sommaire.out
wrong=$(( $asked – $right – 1 ))
echo “The incorrect nouns (” $wrong “):” $wrongverbs | tee >>$temp_path/sommaire.out
num_entries=$(grep “^[0-9]*c:” $dir_txt_path/*.txt | grep -c .)
echo “The database had ” $num_entries “entries.” | tee >>$temp_path/sommaire.out
echo “Your percentage: ” $aver_right | tee >>$temp_path/sommaire.out
cat $temp_path/sommaire.out

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