#-- This script provides a 'gist' translation of a text file, using the #-- i2e.sh utility. Really, the i2e.sh utility is not necessary since all #-- that that program does is look up a plain text dictionary file. #-- This script translates from English into Spanish. The idea is to #-- provide some assistance to a human translator, rather than to provide #-- a 'machine translation' (such as the AltaVista and Google Web Translators) #-- #-- The script is very slow. It can only translate approximately 1 line of #-- text per second. More precisely, using the unix 'time' command revealed #-- that it translates 124 words in 38 seconds. #-- 16 sec/ 55 words #-- for line in $(cat $1 | sed "/^[^a-zA-Z]*$/d" | tr ' ' '#'); do s=$(echo $line | tr '#' ' '); echo $s; plainLine=$(echo $s | tr '[A-Z]' '[a-z]' | sed "s/[^a-z]/ /g") for v in $(echo $plainLine); do i2e.sh -e $v | sed "/^ *$/d" \ | head -1 | sed "s/not found in.*/[???]/gi" \ | sed -e "s/^[^:]*://" -e 's/A (abrev\. de amperio)/uno/i' \ -e "s/^ */ /g" -e "s/ *$/ /g" \ | tr '\n' '+'; done; echo ""; for v in $(echo $plainLine); do i2e.sh -e $v | sed "/^ *$/d" \ | head -2 | tail -1 | sed "s/not found in.*/[???]/gi" \ | sed "s/^[^:]*://" | sed 's/A (abrev\. de amperio)/uno/i' \ | sed "s/^ */ /g" | sed "s/ *$/ /g" \ | tr '\n' '+'; done; echo ""; for v in $(echo $plainLine); do i2e.sh -e $v | sed "/^ *$/d" | head -3 | tail -1 \ | sed "s/not found in.*/[???]/gi" \ | sed "s/^[^:]*://" | sed 's/A (abrev\. de amperio)/uno/i' \ | sed "s/^ */ /g" | sed "s/ *$/ /g" \ | tr '\n' '+' ; done; echo ""; echo "=============================="; done