Transliteration-related information
#25
Following are three basic shell scripts that allow one to process all pages of a transliteration separately. I have used this for many different purposes, and just creating clean texts per page is one of the simplest applications. The scripts are short enough, I think, to just put them inline here.

The highest level script is called all_sh and this is the command one should type, without any arguments. It also does not need to be changed.

---------------------------------------------------------------------------------------------------------

#/bin/sh
#
# Do something for all pages in the MS
#
many_sh A A B C D E F G H I J K L M N O P
many_sh B A B C D E F    I J K L M N O P
many_sh C A B C D E F G H I J K L M N O P
many_sh D A B C D E F G H I J K L M N O P
many_sh E A B C D E F G H I J K L M N O P
many_sh F A B C D E F G H I J K L M N O P
many_sh G A B C D E F G H I J K L M N O P
many_sh H A B C D E F G H
many_sh I  B C  E F  H I J  L M N
many_sh J A B  D E  G H
many_sh K A B  D E F  H I J
many_sh L A B
many_sh M A B C D E F G H I J K L M N O P Q R S T
many_sh N  B C D                  N O P Q
many_sh O A B C D  F G  I J  L M  O P
many_sh Q A B C D  F G  I J K L
many_sh S A B C D E  H        L M  O P
many_sh T A B C D E F G H I J K L M N O P Q R S T U V W X


---------------------------------------------------------------------------------------------------------

This invokes many_sh which also hardly ever needs to be changed. In the following version it saves time by creating temporary files for one quire.

---------------------------------------------------------------------------------------------------------

#!/bin/sh
#
# Repeat a command for all pages in a quire
# Arg 1 is $Q of the quire
# All further arguments are the $P of the pages in that quire
#
qq=${1}
shift
echo "quire " ${qq}
#
qfile=quire${qq}.txt
ivtt -m1 +Q${qq} RF1a-n.txt >${qfile}
for pp in "$@"
do
  once_sh ${qq} ${pp} 2>/dev/null
done
\rm -f ${qfile}


---------------------------------------------------------------------------------------------------------

Finally, the 'clever stuff' is done in once_sh, which in this case is trivial.

---------------------------------------------------------------------------------------------------------

#!/bin/sh
#
# Run a short script once.
# Arg 1 is the $Q variable for a quire.
# Arg 2 is the $P variable for one page.
# It is assumed that a transliteration file for this one quire was
# already prepared at a higher level.
#
qfile=quire${1}.txt
pfile=${1}${2}.txt
#
ivtt -x8 +P${2} ${qfile} >${pfile}


---------------------------------------------------------------------------------------------------------
[+] 1 user says Thank You to ReneZ for this post
Reply


Messages In This Thread
Transliteration-related information - by ReneZ - 21-01-2023, 09:03 AM
RE: Transliteration-related information - by ReneZ - 08-11-2023, 08:50 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)