Las Virtudes (Spanish Lesson #8): Ser (Past, Present, Future) and Adjectives

Exploring the concept of virtue in Spanish.  I am working to reprogram the program to set this file up with another adjective file of virtues.  So far, I have come up with:

inteligente

bonita

amable

simpático,a

trabajador, trabajadora

dulce

tierno, a

fuerte

rápido,a

sano, sana

dotado, dotada

detallado, detallada

ambicioso, ambiciosa

tenaz

amable

sensible

independiente

ingenioso, a

exitoso, exitosa

ciudadoso, ciudadosa

and a few more that I still have to translate:

polite cortés

loyal leal

interesting interesante

patient paciente

self-controlled

good memory

flexible flexible

creative creativo, a

unique única

ability to concentrate

trustworthy confiable

able to heal

curious

considerate considerada

helpful útil

clean or neat limpio, a

Update 5/16/2013:  I have a provisional version of code that combines the verb file 01 spanish-gram.txt with an adjective file in the same subdirectory (called span_grammar) of the directory called news.  The adjective file is called:

01 spanish-gram.adj_txt.  Right now the program is putting out randomly combined sentences in both languages, but I still need to fix the code to select for gender and plural, and to test whether the answers are correct.  In the process of working on things, also, the other options are not working very well.  I will have to fix this.  So, option 4 works – kind of…

Update: 5/17 A few more changes to the code, but things still not matching answers yet, or selecting the adjectives for gender and number.  Working this program makes you feel really good about everyone, including yourself.

Update: 5/20/ The code runs pretty nicely now.  All 4 options.  I still haven’t tested multiple files in the span_grammar directory.  I have to reload the old files onto the new USB.  The computer must be booted in Spanish for the program to work.  It is not enough to relaunch the X-server (that doesn’t require the boot CD) with the Spanish options set.  Also, although not visually apparent in the text file, one must have the country and keyboard options set to Spanish when opening and editing the txt files.  If, for example, you accidentally use the Portuguese option to edit the Spanish file, the accents will not work until you copy and paste the Portuguese text through the clipboard to a new file opened and edited under the Spanish language option.  So, if accents aren’t working, check this.  The program still needs a bench.

working_4option_programfile spanish_gram.txt edited 5/20/2013

01c: happy  ENG: feliz, feliz, felices, felices
02c: content  ENG: contento, contenta, contentos, contentas
03c: funny  ENG: raro, rara, raros, raras
04c: brave  ENG: valeroso, valerosa, valerosos, valerosas
05c: valient  ENG: valiente, valiente, valientes, valientes
06c: articulate  ENG: claro, clara, claros, claras
07c: flexible  ENG: flexible, flexible, flexibles, flexibles
08c: resilient  ENG: resistente, resistente, resistentes, resistentes
09c: loving  ENG: cariñoso, cariñosa, cariñosos, cariñosas
10c: trustworthy  ENG: comfiable, comfiable, comfiables, comfiables
11c: curious  ENG: curioso, curiosa, curiosos, curiosas
12c: considerate  ENG: considerado, considerada, considerados, consideradas
13c: intelligent  ENG: inteligente, inteligente, inteligentes, inteligentes
14c: beautiful  ENG: bonito, bonita, bonitos, bonitas
15c: amiable  ENG: amable, amable, amables, amables
16c: nice  ENG: simpático, simpática, simpáticos, simpáticas
17c: hardworking  ENG: trabajador, trabajadora, trabajadores, trabajadoras
18c: gentle  ENG: dulce, dulce, dulces, dulces
19c: protective  ENG: protecturo, protectura, protecturos, protecturas
20c: strong  ENG: fuerte, fuerte, fuertes, fuertes
21c: fast  ENG: rápido, rápida, rápidos, rápidas
22c: healthy  ENG: sano, sana, sanos, sanas
23c: talented  ENG: dotado, dotada, dotados, dotadas
24c: detailed  ENG: detallado, detallada, detallados, detalladas
25c: ambitious  ENG: ambicioso, ambiciosa, ambiciosos, ambiciosas
26c: tenacious  ENG: tenaz, tenaz, tenaces, tenaces
27c: polite  ENG: educadoso, educadosa, educadosos, educadosas
28c: sensitive  ENG: sensible, sensible, sensibles, sensibles
29c: independent  ENG: independiente, independiente, independientes, independientes
30c: resourceful  ENG: ingenioso, ingeniosa, ingeniosos, ingeniosas
31c: successful  ENG: exitoso, exitosa, exitosos, exitosas
32c: careful  ENG: ciudadoso, ciudadosa, ciudadosos, ciudadosas
33c: original  ENG: originale, originale, originales, originales
34c: agile  ENG: ágil, ágila, ágiles, ágiles
35c: creative  ENG: creativo, creativa, creativos, creativas

————————————————————————————

The verb file

file 01 spanish-gram.txt edited 5/15/2013
01c: I am  ENG: Yo soy   SENT: I (m) am
02c: I am  ENG: Yo soy  SENT: I (f) am
03c: You are  ENG: Tú eres  SENT: You (m, informal, s) are
04c: You are  ENG: Tú eres  SENT: You (f, informal, s) are
05c: He is  ENG: Él es  SENT: He is
06c: She is  ENG: Ella es  SENT: She is
07c: You are  ENG: Usted es  SENT: You (m, formal, s) are
08c: You are  ENG: Usted es  SENT: You (f, formal, s) are
09c: We are  ENG: Nosotros somos  SENT: We (m) are
10c: We are  ENG: Nosotras somos  SENT: We (f) are
11c: You are  ENG: Vosotros sois  SENT: You (m, informal, p) are
12c: You are  ENG: Vosotras sois  SENT: You (f, informal, p) are
13c: They are  ENG: Ellos son  SENT: They (m) are
14c: They are  ENG: Ellas son  SENT: They (f) are
15c: You are  ENG: Ustedes son  SENT: You (m, formal, p) are
16c: You are  ENG: Ustedes son  SENT: You (f, formal, p) are
17c: I will be  ENG: Yo seré  SENT: I (m) will be
18c: I will be  ENG: Yo seré  SENT: I (f) will be
19c: You will be  ENG: Tú serás  SENT: You (m, informal, s) will be
20c: You will be  ENG: Tú serás  SENT: You (f, informal, s) will be
21c: He will be  ENG: Él será  SENT: He will be
22c: She will be  ENG: Ella será  SENT: She will be
23c: You will be  ENG: Usted será  SENT: You (m, formal, s) will be
24c: You will be  ENG: Usted será  SENT: You (f, formal, s) will be
25c: We will be  ENG: Nosotros seremos  SENT: We (m) will be
26c: We will be  ENG: Nosotras seremos  SENT: We (f) will be
27c: You will be  ENG: Vosotros seréis  SENT: You (m, informal, p) will be
28c: You will be  ENG: Vosotras seréis  SENT: You (f, informal, p) will be
29c: They will be  ENG: Ellos serán  SENT: They (m) will be
30c: They will be  ENG: Ellas serán  SENT: They (f) will be
31c: You will be  ENG: Ustedes serán  SENT: You (m, formal, p) will be
32c: You will be  ENG: Ustedes serán  SENT: You (f, formal, p) will be
33c: I was  ENG: Yo fui  SENT: I (m) was
34c: I was  ENG: Yo fui  SENT: I (f) was
35c: You were  ENG: Tú fuiste  SENT: You (m, informal, s) were
36c: You were  ENG: Tú fuiste  SENT: You (f, informal, s) were
37c: He was  ENG: Él fue  SENT: He was
38c: She was  ENG: Ella fue  SENT: She was
39c: You were  ENG: Usted fue  SENT: You (m, formal, s) were
40c: You were  ENG: Usted fue  SENT: You (f, formal, s) were
41c: We were  ENG: Nosotros fuimos  SENT: We (m) were
42c: We were  ENG: Nosotras fuimos  SENT: We (f) were
43c: You were  ENG: Vosotros fuisteis  SENT: You (m, informal, p) were
44c: You were  ENG: Vosotras fuisteis  SENT: You (f, informal, p) were
45c: They were  ENG: Ellos fueron  SENT: They (m) were
46c: They were  ENG: Ellas fueron  SENT: They (f) were
47c: You were  ENG: Ustedes fueron  SENT: You (m, formal, p) were
48c: You were  ENG: Ustedes fueron  SENT: You (f, formal, p) were

————————————————————————————

The code (the beast!)

#!/bin/bash
# news_spanish.sh v.1.16 a program submitted by livedoggb on May 20/2013
# dependencies compiled random1.c, and intdiv2float.c and a news directory
# with files called 01 spanish-news.txt, 02 spanish-news.txt …
# itunes directory named news with songs that you want to use sequentially numbered 01 …, 02 …, 03 … etc.
# NYI: not yet implemented
# NYI: 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.
# Uncomment 139 and 167 to check gender and number

mnt_path=”/mnt/sdb1/”
dir_path=”$mnt_path/news/”
temp_path=”/root/”
temp_file=”$temp_path/temp.out”
dir_cprog=$( echo “$mnt_path/for_kids/c_progs/” )
LANG=es_ES.UTF-8
#LANG=pt_PT.UTF-8
#LANG=el_GR.UTF-8
language=$( printenv | grep LANG | sed -e “s/LANG=//” )
LANG=$( echo $language )
echo $LANG
read
music_flag=”on”
function echo_in_color_br_sentence {
case $choice in
1)
part1=$( echo $testline | sed “s/\(.*\)\(_*_\)\(.*\)/\1/” )
part2=$( echo $testline | sed “s/\(.*\)\(_*_\)\(.*\)/$echo_verb/” )
part3=$( echo $testline | sed “s/\(.*\)\(_*_\)\(.*\)/\3/” )
#”blue”
l1=$( echo “$part1”  | sed “s/_*//g”  | sed “s/ *//” )
#”red”
#echo -n -e ‘\E[47;31m'”33[1m””$part2″”33[0m” | sed “s/_*//g” | sed “s/ *//g” )
#”blue”
l2=$( echo “$part2” | sed “s/_*//g” | sed “s/ *//” )
#”blue”
l3=$( echo “$part3” | sed “s/_*//g” | sed “s/ *//” )
tput sgr0
line=$( echo -e ” $l1 “” $l2 “” $l3 ”  )
;;
2)
part1=$( echo $testline | sed “s/\(.*\)\(_*_\)\(.*\)/\1/” )
part2=$( echo $testline | sed “s/\(.*\)\(_*_\)\(.*\)/$echo_verb/” )
part3=$( echo $testline | sed “s/\(.*\)\(_*_\)\(.*\)/\3/” )
#”blue”
l1=$( echo “$part1”  | sed “s/_*//g”  | sed “s/ *//” )
#”red”
#echo -n -e ‘\E[47;31m'”33[1m””$part2″”33[0m” | sed “s/_*//g” | sed “s/ *//g” )
#”blue”
l3=$( echo “$part3” | sed “s/_*//g” | sed “s/ *//” )
tput sgr0
line=$( echo -e ” $l1 “” $l2 “” $l3 ”  )
l2=$( echo “$part2” | sed “s/_*//g” | sed “s/ *//” )
;;
3)
line=$( echo $testline | sed “s/\(.*\).$/\1/” )
;;
4)
;;
esac
return
}

function trim_line {
i=1
echo
#LANG=es_ES.UTF-8
#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 {
#LANG=es_ES.UTF-8
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/^.*  SENT:\(.*\)/\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 get_number_and_gender {
LANG=es_ES.UTF-8
gender=$( echo $echo_verb | sed -e “s/.*(\([m|f]\).*$/\1/” )
gr=””
gr=$( echo $echo_verb |  sed -e “s/She.*$/She/”)
if [ “$gr” == “She” ]
then
gender=”f”
fi
gr=$( echo $echo_verb | sed -e “s/He.*/He/” )
if [ “$gr” == “He” ]
then
gender=”m”
fi
# echo gender is $gender
number=$( echo $echo_verb | sed -e “s/.*, \([s|p]\)).*$/\1/” )
gr=””
gr=$( echo $echo_verb |  sed -e “s/She.*$/She/”)
if [ “$gr” == “She” ]
then
number=”s”
fi
gr=$( echo $echo_verb | sed -e “s/He.*/He/” )
if [ “$gr” == “He” ]
then
number=”s”
fi
gr=$( echo $echo_verb | sed -e “s/We.*/We/” )
if [ “$gr” == “We” ]
then
number=”p”
fi
gr=$( echo $echo_verb | sed -e “s/I.*/I/” )
if [ “$gr” == “I” ]
then
number=”s”
fi
gr=$( echo $echo_verb | sed -e “s/They.*/They/” )
if [ “$gr” == “They” ]
then
number=”p”
fi
#echo number is $number (uncomment this to check number)
#echo “this is show the sentence in english with parentheses”

return
}
function select_word_from_adj_list {
LANG=es_ES.UTF-8
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*ENG:\(.*\)SENT:.*/\1/”)

adjective=$( grep “^$correctquizfact2:” “$language_primer”/$fn*.adj_txt | sed -e “s/^.*ENG:\(.*\)/\1/”)
#gender=$( echo $adjective | sed -e “s/^.*(\(.\),.*/\1/” )
#echo “gender is ” $gender
#adjective=”feliz”
# act=”read”
#—-show_the_sentence
#echo “gender is ” $gender
#echo “number is ” $number
org_adjective=$adjective
#echo “adjective is ” $adjective
#adjective=$( echo $org_adjective | cut -d”,” -f1 )
#echo “adjective is ” $adjective
#adjective=$( echo $org_adjective | cut -d”,” -f2 )
#echo “adjective is ” $adjective
#adjective=$( echo $org_adjective | cut -d”,” -f3 )
#echo “adjective is ” $adjective
#adjective=$( echo $org_adjective | cut -d”,” -f4 )
#echo “adjective is ” $adjective
if [ $gender == “m” ]&&[ $number == “s” ]
then
adjective=$( echo $org_adjective | cut -d”,” -f1 )
fi
if [ $gender == “f” ]&&[ $number == “s” ]
then
adjective=$( echo $org_adjective | cut -d”,” -f2 )
fi
if [ $gender == “m” ]&&[ $number == “p” ]
then
adjective=$( echo $org_adjective | cut -d”,” -f3 )
fi
if [ $gender == “f” ]&&[ $number == “p” ]
then
adjective=$( echo $org_adjective | cut -d”,” -f4 )
fi
testline=$( echo $testline $adjective )
#echo “testline is :” $testline
#echo_verb=$testline
#read_sentence_outloud
return
}

function show_the_sentence {
LANG=es_ES.UTF-8
l1=$( echo $language1 | sed -e “s/kids-//” )
echo -n “The current phrase is: ”
echo_adj=””
echo_verb=””
if [ $choice != 4 ]
then
echo_in_color_noun_w_gender  “random quiz line is:” $quizfact
fi
line=$testline
verb_guess=””
asked=$(( $asked + 1 ))
LANG=es_ES.UTF-8
case “$choice” in
default)
;;
1)
#LANG=es_ES.UTF-8
echo_verb=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^[0-9]*c: \(.*\)  ENG: \(.*\)  SENT: .*/\2/” )
#echo $echo_verb
if [ “$act” == “read” ]
then
if [ “$choice” == “1” ]
then
echo_in_color_br_sentence
fi
fi
trim_line
;;
2)
echo_verb=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^[0-9]*c: \(.*\)  ENG: \(.*\)  SENT: .*/\2/” )
#echo $echo_verb
if [ “$act” == “read” ]
then
if [ “$choice” == “1” ]
then
echo_in_color_br_sentence
fi
fi
trim_line
;;
3)
echo_verb=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^[0-9]*c: \(.*\)  ENG: \(.*\)  SENT: \(.*\)/\2/” )
;;
4)
echo_verb=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^[0-9]*c: \(.*\)  ENG: \(.*\)  SENT: \(.*\)/\3/” )
echo_adj=$( grep “^$correctquizfact2:” “$language_primer”/$fn*.adj_txt | sed -e “s/^[0-9]*c: \(.*\)  ENG:.*/\1/” )
echo_verb=$(echo $echo_verb $echo_adj)
echo $echo_verb
get_number_and_gender
select_word_from_adj_list
;;
esac
if [ “$act” == “read” ]
then
if [ “$choice” == “1” ]
then
echo_in_color_br_sentence
fi
fi
# trim_line stopped in option 4
verb_guess=””
while [ “$verb_guess” == “” ]
do
#l2=$( echo $language2 | sed -e “s/kids-queens//” )
echo “Enter a guess (enter e to exit):”
read verb_guess
done
if [ “$verb_guess” == “e” ]
then
break
fi
#echo $verb_guess”xxx”=$testline”xxx”
if [ “$choice” == “1” ]
then
testline=$echo_verb
fi
if [ “$choice” == “2” ]
then
testline=$echo_verb
fi
if [ “$verb_guess” == “$testline” ]
then
echo “Correct.”
right=$(( $right + 1 ))
average=$(( $right/$asked ))
rightverbs=$( echo $rightverbs, $echo_verb)
if [ “$music_flag” == “on” ]
then
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/news/$num_mus*.*
fi
else

echo “No.  The correct response is: ” $testline
#echo used to be $echo_verb
#echo   “random quiz line is:” $quizfact

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

echo
return
}

function read_clueword_outloud {
#LANG=es_ES.UTF-8
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
#LANG=es_ES.UTF-8
return
}

function read_englishword_outloud {
#LANG=es_ES.UTF-8
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
#LANG=es_ES.UTF-8
#language=$( printenv | grep LANG | sed -e “s/LANG=//” )
#LANG=$( echo $language )
#echo $LANG

return
}

function echo_in_color_noun_w_gender {
#LANG=es_ES.UTF-8
language=$( printenv | grep LANG | sed -e “s/LANG=//” )
#LANG=$( echo $language )
#echo $LANG
l=$( echo $language | sed -e “s/kids-//” )
l=”spanish”

case $l  in
default)
LANG=es_ES.UTF-8
;;
“bulgarian”)
LANG=bg_BG.UTF-8
;;
“russian”)
LANG=ru_RU.UTF-8
;;
“german”)
LANG=de_DE.UTF-8
;;
“greek”)
LANG=el_GR.UTF-8
;;
“indonesian”)
LANG=id_ID.UTF-8
;;
“malay”)
LANG=id_ID.UTF-8
;;
“dutch”)
LANG=nl_NL.UTF-8
;;
“hungarian”)
LANG=hu_HU.UTF-8
;;
“polish”)
LANG=pl_PL.UTF-8
;;
“latvian”)
LANG=lv_LV.UTF-8
;;
“lithuanian”)
LANG=lt_LT.UTF-8
;;
“chinese”)
LANG=zh_CN.UTF-8
;;
“japanese”)
LANG=ja_JP.UTF-8
;;
“korean”)
LANG=ko_KR.UTF-8
;;
“arabic”)
LANG=ar_SY.UTF-8
n2=$( echo $noun )
echo   $( /mnt/sdb1/for_kids/c_progs/rev_str2 $n2 )
;;
“hebrew”)
LANG=he_IL.UTF-8
n2=$( echo $noun | sed -e “s/(.)//” )
#      echo $n2
#      $dir_cprog/rev_str2  $n2  > $temp_path/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
;;
“icelandic”)
LANG=nn_NO
;;
esac
#LANG=es_ES.UTF-8

color=x
if [ $choice == “1” ]
then
echo_verb=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^[0-9]*c: \(.*\)  ENG: \(.*\)  SENT: .*/\1/” )
noun=$echo_verb
fi
if [ $choice == “2” ]
then
echo_verb=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^[0-9]*c: \(.*\)  ENG: \(.*\)  SENT: .*/\1/” )
noun=$echo_verb
fi
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”
;;
“x”)
echo “$noun”
# above is not used echo “correct?”
;;
esac
#LANG=es_ES.UTF-8
tput sgr0
return
}
function select_language2 {
lang_picked=”notpicked”
#LANG=es_ES.UTF-8
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
#LANG=es_ES.UTF-8
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 &
#LANG=es_ES.UTF-8
return
}

function select_language1 {
#LANG=es_ES.UTF-8
lang_picked=”notpicked”
while [ $lang_picked == “notpicked” ]
do
echo “Available clue languages are:”
echo  “1. French        16. Dutch”
echo  “2. German        17. Hindi”
echo  “3. Spanish       18. Urdu”
echo  “4. Italian       19. Sanskrit”
echo  “5. Portuguese    20. Swahili”
echo  “6. Greek         21. Afrikaans”
echo  “7. Hebrew        22. Bulgarian”
echo  “8. Arabic        23. Indonesian”
echo  “9. Farsi         24. Hungarian”
echo  “10. Syriac       25. Icelandic”
echo  “11. Chinese      26. Latvian”
echo  “12. Russian      27. Lithuanian”
echo  “13. Polish       28. Malay”
echo  “14. Irish        29. Japanese”
echo  “15. Norwegian    30. Korean”

echo
echo -n “Enter a number:”
read lang_num
#    if [ “$lang_num” -gt 6 ]
#       then
#         echo “Language not yet available.  Pick another one. ”
#    fi
#LANG=es_ES.UTF-8
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”
;;
21)
language=”kids-afrikaans”
lang_picked=”picked”
;;
22)
language=”kids-bulgarian”
lang_picked=”picked”
;;
23)
language=”kids-indonesian”
lang_picked=”picked”
;;
24)
language=”kids-hungarian”
lang_picked=”picked”
;;
25)
language=”kids-icelandic”
lang_picked=”picked”
;;
26)
language=”kids-latvian”
lang_picked=”picked”
;;
27)
language=”kids-lithuanian”
lang_picked=”picked”
;;
28)
language=”kids-malay”
lang_picked=”picked”
;;
29)
language=”kids-japanese”
lang_picked=”picked”
;;
30)
language=”kids-korean”
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
#LANG=es_ES.UTF-8
return
}

function set_paths {
#LANG=es_ES.UTF-8
#clue language is lang1
#reading language is lang2
lang2=$( echo “$language2”)
tvf2=$( echo “$lang2”)
dir_txt_path2=$( echo “$dir_path”/$tvf2/$lang2/current_file )
tvs2=$( echo “$tvf2″_sound )
lang1=$( echo “$language1″”$lang2”)
tvf1=$( echo “$lang1”)
dir_txt_path1=$( echo “$dir_path”/$lang2/$tvf1/current_file )
tvs1=$( echo “$tvf1″_sound )
sound_path1=$( echo “$dir_path”/$tvs2/”$language1″_sound_nouns/ )
sound_path2=$( echo “$dir_path”/$tvs2/”$language2″_sound_nouns/ )

case “$choice” in
default)
lang2=$( echo “$language2”)
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/ )
current_file=”current_file”
;;
3)
tvf2=$( echo “$lang2”)
dir_txt_path2=$( echo “$dir_path”/$tvf2/$lang2/span_grammar/ )
tvf1=$( echo “$lang1”)
dir_txt_path1=$( echo “$dir_path”/$lang2/$tvf1/span_grammar/ )
current_file=”span_grammar”
;;
4)
tvf2=$( echo “$lang2”)
dir_txt_path2=$( echo “$dir_path”/$tvf2/$lang2/span_grammar/ )
tvf1=$( echo “$lang1”)
dir_txt_path1=$( echo “$dir_path”/$lang2/$tvf1/span_grammar/ )
current_file=”span_grammar”
;;
esac

#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
#LANG=es_ES.UTF-8
return
}

clear
#select_language2
#select_language1
set_paths
#LANG=es_ES.UTF-8
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/current_file ]
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/news/*.* | 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=0
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 “Use music? (y or n): default is y.”
read ans
if [ “$ans” == “n” ]
then
music_flag=”off”
fi
echo
echo “Several options are possible.  Please choose a level (enter a number between 1 and 6).”
echo
echo “Level 1.  Find the words.”
echo “Level 2.  Guess the words.”
echo “Level 3.  Spanish grammar. English to Spanish translation.”
echo “Level 4.  More complex Spanish grammar.  English to Spanish translation.”
#echo “Level 4.  Spanish grammar.  English to Spanish translation.”
#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 words.”
sum_mistakes=0
;;
2)
echo “Level 2.”
echo “Guess the words.”
sum_mistakes=0
;;
3)
echo “Level 3.”
echo “Translate the sentence into Spanish.”
set_paths
#echo “Write the $language2 word that you hear.”
#sum_mistakes=0
;;
4)
echo “Level 4.”
echo “Translate the sentence into Spanish.”
set_paths
#echo “Translate the sentence into English.”
#set_paths
#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=””
LANG=es_ES.UTF-8
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)
if [ $choice == 4 ]
then
maxlinenum2=$( grep -c . “$language_primer”/$fn*.adj_txt)
maxlinenum2=$(( $maxlinenum2 – 1 ))
quizfact=$( “$dir_cprog”/random1 1 $maxlinenum2)
correctquizfact2=$( echo “$quizfact”c)
fi
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:\(.*\)/\3/” )
case $choice in
default)
;;
4)
adjective=$( grep “^$correctquizfact2:” “$language_primer”/$fn*.adj_txt | sed -e “s/^.*c:\(.*\) ENG:\(.*\)/\1/”)
noun=$( echo $noun $adjective )
;;
esac
# echo “The current phrase is” $noun
case $choice in
default)
echo “Not a valid choice.”
exit
;;
1)
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*SENT:\(.*\)/\1/” )
act=”read”
show_the_sentence
#read_sentence_outloud
;;
2)
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*SENT:\(.*\)/\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/”)
testline=$( grep “^$correctquizfact:” “$language_primer”/$fn*.txt | sed -e “s/^.*ENG: \(.*\)  SENT:.*/\1/”)

#act=”read”
show_the_sentence
#read_sentence_outloud
;;
4)
show_the_sentence
#select_word_from_adj_list
;;
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/” )
wrong=$(( $asked – $right – 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 ” $wrong ” mistakes and ” $sum_faults “dictation faults.” | tee >> $temp_path/sommaire.out
echo “The correct nouns (” $right “):” $rightverbs  | tee >>$temp_path/sommaire.out
echo “The incorrect nouns (” $wrong “):” $wrongverbs | tee >>$temp_path/sommaire.out
case $choice in
1)
num_entries=$(grep “^[0-9]*c:” $dir_path/current_file/*.txt | grep -c .)
;;
2)
num_entries=$(grep “^[0-9]*c:” $dir_path/current_file/*.txt | grep -c .)
;;
3)
num_entries=$(grep “^[0-9]*c:” $dir_path/$current_file/*.txt | grep -c .)
;;
4)
num_entries1=$(grep “^[0-9]*c:” $dir_path/$current_file/*.txt | grep -c .)
num_entries2=$(grep “^[0-9]*c:” $dir_path/$current_file/*.adj_txt | grep -c .)
num_entries=$num_entries1″x”$num_entries2
;;
esac
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