# Description # This script takes the raw phrase-list data that has been extracted from the # Web-Site http://www.intercat.gencat.es/ and attempts to reform it so that it # can be used by a language tutoring program such as the one at # http://www.geocities.com/matth3wbishop/ This language tutoring program uses an # array that is in the following format # sound-file-url||textual-equivalent-of-sound-file||translation-of-textual-equivalent|| # In other words, each element of the array (in this case a client-side Javascript array # is a text string which is itself a 'two bar delimited' valued consisting of three (and # possibly more) values. # # The present script is an attempt to reformat the data that has been extracted into a # format which will then be useable by another script to create the final array. # # Notes: # This script is quite 'destructive' of the initial data (as obtained with the program # html2text from the gencat site. The reason for this is that I wish to eliminate any # 'bad' data even if this means getting rid of some good data. I this there is enough # data to justify this. # See Also: # Author: # m.j.bishop if [ "$1" = "" ] then echo "usage: $0 textFileName" cat $0 | sed -n "/^[ ]*#/p" exit 1; fi sFileName="$1" cat $sFileName | \ sed -e "s/^[[:space:]]*//g" \ -e "s/[[:space:]]*$//g" \ -e "/\[URL=/d" \ -e "/You can listen to the phrases/d" \ -e "/\-/! h" -e "/\-/{G;s/\-\([^\-]\+\)\-\([^\n]\+\)\n\(.*\)[ ]\{4\}\(.*\)/\3 \1 \4 \2/g;}" \ -e "/\-/d" \ -e "s/^\(.*\) \{7\}\(.*\)$/\1|\2/g" \ -e "s/[ ]*|/|/g" | \ grep "|" | \ tr -s ' '