summaryrefslogtreecommitdiffstats
path: root/modules/mt-lxx-parallel/convert.pl
diff options
context:
space:
mode:
authorMartin Gruner <mg.pub@gmx.net>2005-10-27 21:02:11 +0000
committerMartin Gruner <mg.pub@gmx.net>2005-10-27 21:02:11 +0000
commit88d0e07a30f5455d9d0cc3e3922772c772ea0a50 (patch)
tree26532a9a70a0701b0ac66accd88dc82a1d7d18b4 /modules/mt-lxx-parallel/convert.pl
parenta3f41bf9c6d57f33050a69131f1acbe9088f69f3 (diff)
downloadsword-tools-88d0e07a30f5455d9d0cc3e3922772c772ea0a50.tar.gz
update
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@48 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'modules/mt-lxx-parallel/convert.pl')
-rw-r--r--modules/mt-lxx-parallel/convert.pl387
1 files changed, 246 insertions, 141 deletions
diff --git a/modules/mt-lxx-parallel/convert.pl b/modules/mt-lxx-parallel/convert.pl
index f38c6bd..e2302ad 100644
--- a/modules/mt-lxx-parallel/convert.pl
+++ b/modules/mt-lxx-parallel/convert.pl
@@ -33,6 +33,7 @@ my %hebrew2utf8 = (
"X" =>chr(0x05D7), #HEBREW LETTER HET
"+" =>chr(0x05D8), #HEBREW LETTER TET
"Y" =>chr(0x05D9), #HEBREW LETTER YOD
+"I" =>chr(0x05D9), #HEBREW LETTER YOD # TODO: this occured in a retranslation (KI)
#"K" =>chr(0x05DA), #HEBREW LETTER FINAL KAF # TODO: HANDLE FINAL LETTERS
"K" =>chr(0x05DB), #HEBREW LETTER KAF
"L" =>chr(0x05DC), #HEBREW LETTER LAMED
@@ -69,6 +70,8 @@ my %hebrew2utf8 = (
);
+my $greekLetters = "A-Z#3\(\)+=|\\/";
+
my %greek2utf8 = (
"\\"=>chr(0x0300), #COMBINING GRAVE ACCENT
"/" =>chr(0x0301), #COMBINING ACUTE ACCENT
@@ -79,13 +82,9 @@ my %greek2utf8 = (
"|" =>chr(0x0345), #COMBINING GREEK YPOGEGRAMMENI / IOTA SUBSCRIPT
"'" => "'",
-"{" => "{", # TODO: CHECK IF NECCESSARY
-"}" => "}",
-"." => ".",
-"^" => "^",
-"?" => "?",
-
+"?" => "<note type=\"textual\">Uncertain.</note>", #HACK
+"^" => "^",
# "*A" =>chr(0x0391), #GREEK CAPITAL LETTER ALPHA
# "*B" =>chr(0x0392), #GREEK CAPITAL LETTER BETA
@@ -150,8 +149,8 @@ my %notes = (
"*" => "Ketib.",
"**" => "Qere.",
"*z" => "Qere wela ketib, ketib wela qere.",
-"[ ]" => "Reference of number of verse in LXX, different from MT.", # TODO: MAKE USE OF IT
-"[[ ]]" => "Reference number of verse in MT, different from the LXX.",
+#"[ ]" => "Reference of number of verse in LXX, different from MT.", # TODO: MAKE USE OF IT
+#"[[ ]]" => "Reference number of verse in MT, different from the LXX.",
"{x}" => "UNKNOWN", # TODO: FIX
"--- {x}" => "Apparent minus created by lack of equivalence between long stretches of text in the LXX and MT.",
"--+ {x}" => "Apparent plus created by lack of equivalence between long stretches of text in the LXX and MT.",
@@ -160,8 +159,12 @@ my %notes = (
"~~~" => "Equivalent of the Hebrew or Greek word(s) occurring elsewhere in the verse or context (transposition).",
"{..~}" => "Stylistic or grammatical transposition.",
"{..}" => "Stylistic or grammatical transposition.", # TODO: occurs in the text, unknown meaning
+"{...}" => "Stylistic or grammatical transposition.", # TODO: occurs in the text, unknown meaning
+"{....}" => "Stylistic or grammatical transposition.", # TODO: occurs in the text, unknown meaning
"---" => "In the Greek column: Hebrew counterpart lacking in the LXX (minus in the LXX).",
+"---?" => "In the Greek column: Hebrew counterpart lacking in the LXX (minus in the LXX)?",
"--" => "In the Greek column: Hebrew counterpart lacking in the LXX (minus in the LXX).", # TODO: my addition, check, probably wrong
+"--?" => "In the Greek column: Hebrew counterpart lacking in the LXX (minus in the LXX)?", # TODO: my addition, check, probably wrong
"--+" => "In col a. of the Hebrew: element \"added\" in the Greek (plus in the LXX).",
"---+" => "In col a. of the Hebrew: element \"added\" in the Greek (plus in the LXX).", # TODO: my addition
"'" => "Long minus or plus (at least four lines).", # TODO: my addition, check
@@ -173,38 +176,58 @@ my %notes = (
"?" => "Questionable notation, equivalent, etc.",
"??" => "Questionable notation, equivalent, etc.", # TODO: my addition
"{p}" => "Greek preverb representing Hebrew preposition.",
+"{pm}" => "Greek preverb representing Hebrew preposition.", # TODO: my addition, check
"{..p}" => "Preposition added in the LXX in accordance with the rules of the Greek language or translational habits.",
+"{+}" => "Unknown.", # TODO: occurs in the text, unknown meaning
+"{+?}" => "Unknown?", # TODO: occurs in the text, unknown meaning
+
"{!}" => "Infinitive absolute.",
+"{!}+" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
+"{!}n" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}na" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
+"{!}na+" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}ad" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}aj" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}nad" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}nd" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
+"{!}ndd" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}nd+" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}p" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}p+" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
+"{!}pc" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}pd" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}-" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{!}v" => "Infinitive absolute.", # TODO: occurs in the text, but unknown meaning
"{s}" => "Hebrew M/, MN (comparative, superlative) reflected by Greek comparative or superlative.", # TODO: UTF-8
"{t}" => "Transliterated Hebrew word.",
-"\#" => "Long line continuing in next one, placed both at the end of the line running over and at the beginning of the following line in the opposite column.",
+"{t.}" => "Transliterated Hebrew word.", # TODO: unknown
+"<t?>" => "Transliterated Hebrew word.", # TODO: unknown
+"{t?}" => "Transliterated Hebrew word?",
+"{c}" => "Unknown.", # TODO: unknown
+
+
+"#" => "Long line continuing in next one, placed both at the end of the line running over and at the beginning of the following line in the opposite column.",
"{v}" => "The reading of the main text of the LXX seems to reflect a secondary text, while the \"original\" reading is reflected in a variant.",
# Notes regarding ColB of the Hebrew
-"=" => "Introducing col. b of the Hebrew (a selection of retroverted readings, presumably found in the parent text of the LXX).",
+#"=" => "Introducing col. b of the Hebrew (a selection of retroverted readings, presumably found in the parent text of the LXX).",
"={d}" => "Reference to doublet (occurring between the two elements of the doublet).", # TODO: my addition, check
+"={d}\@" => "Reference to doublet (occurring between the two elements of the doublet). Etymological exegesis.", # TODO: my addition, check
"={d?}" => "Reference to doublet (occurring between the two elements of the doublet)?", # TODO: my addition, check
"=\%" => "Introducing categories of translation technique recorded in col. b.",
"=\%vap" => "Change from active to passive form in verbs.",
"=\%vpa" => "Change from passive to active form in verbs.",
"=\%p" => "Difference in preposition or particle.",
+"=\%p?" => "Difference in preposition or particle?",
+"=p" => "Difference in preposition or particle.", # TODO: my addition, check, uncertain?
"=\%pa" => "Difference in preposition or particle.", # TODO: my addition, check
+"=\%p=" => "Difference in preposition or particle.", # TODO: my addition, check
"=\%p+" => "Addition of preposition or particle.",
"=\%p+?" => "Addition of preposition or particle?",
"=\%p-" => "Omission of preposition or particle.",
+"=p-" => "Omission of preposition or particle.", # TODO: my addition, check, uncertain?
"=;" => "Retroversion in col. b based on equivalence occurring in immediate or remote context.",
#"G" => "Hebrew variant, but at this stage no plausible retroversion is suggested.",
"=+" => "Difference in numbers between MT and the LXX.",
@@ -213,8 +236,11 @@ my %notes = (
"=\@?" => "Etymological exegesis?", #my addition
"=\@...a" => "Etymological exegesis according to Aramaic.",
"=:" => "Introducing reconstructed proper noun.",
+":" => "Introducing reconstructed proper noun.", #my addition
"=v" => "Difference in vocalization (reading).",
+"=v?" => "Difference in vocalization (reading)?",
"=vs" => "Difference in vocalization (reading).", # TODO: check, occurs in text
+"=>" => "Difference in vocalization (reading).", # TODO: check, occurs in text
"=r" => "Incomplete retroversion.",
"{*}" => "Agreement of LXX with ketib.",
@@ -234,6 +260,7 @@ my %notes = (
"<sp^>" => "<sp^>", #TODO: FIX, occurs in text
"^" => "^", #Notsure what these are
+"?^" => "?^", #Notsure what these are
"^^^" => "^^^",
);
@@ -254,43 +281,58 @@ sub closeNote(){
sub translateHebrewNote(){
my $origNote = shift;
-# print("TranslateHebrewNote $origNote\n");
- ($origNote =~ m/^=?\.([a-z()\$+-])([a-z()\$+-])$/) and
+ print("TranslateHebrewNote $origNote\n");
+
+ ($origNote eq "=") and return; #= only marks colB, no real note
+
+ ($notes{ $origNote }) and return( &createNote( $notes{$origNote} ) );
+
+ ($origNote =~ m/^=?\.([a-z()&\$+-])([a-z()&\$+-]+)$/) and
return( &createNote("Interchange of consonants (" .
- &translateHebrewLetter( uc( $1 ) ) . "/" . &translateHebrewLetter( uc( $2 ) ) .
+ &translateHebrewLetters( uc( $1 ) ) . "/" . &translateHebrewLetters( uc( $2 ) ) .
") between MT and the presumed Hebrew parent text of the LXX.") );
+ ($origNote =~ m/^\[(.+)\]/) and
+ return( &createNote( "Number of verse in LXX ($1) is different from MT." ) );
- ($origNote =~ m/^{\.\.d(.+)}/) and
+
+ ($origNote =~ m/^=?{\.\.d(.+)}/) and
return( &createNote("(".&translateHebrewWordorNote( $1 ).") ". $notes{ "{..d}" }) );
- ($origNote =~ m/^{\.\.r(.+)}/) and
+ ($origNote =~ m/^=?{\.\.\.r(.+)}/) and
+ return( &createNote("(".&translateHebrewWordorNote( $1 ).") ". $notes{ "{..r}" }) );
+
+ ($origNote =~ m/^=?{\.\.r(.+)}/) and
return( &createNote("(".&translateHebrewWordorNote( $1 ).") ". $notes{ "{..r}" }) );
- ($origNote =~ m/^{\.\.\.(.+)}/) and
+ ($origNote =~ m/^=?{\.\.\.(.+)}/) and
return( &createNote("(".&translateHebrewWordorNote( $1 ).") ". $notes{ "{...}" }) );
- ($origNote =~ m/^{\.\.(.+)}/) and
+ ($origNote =~ m/^=?{\.\.(.+)}/) and
return( &createNote("(".&translateHebrewWordorNote( $1 ).") ". $notes{ "{..}" }) );
- #Special cases: the note includes more than one hebrew word, "cat" the results together
- ($origNote =~ m/^{\.\.\.([^}]+)$/) and
- return( &openNote("(".&translateHebrewWordorNote($1).") ".$notes{"{...}"} ) );
+ #Special cases: the note includes more than one word, "cat" the results together
+ ($origNote =~ m/^=?{\.\.\.([^}]+)$/) and
+ return( &openNote( $notes{"{...}"} . "(".&translateHebrewWordorNote($1) ." " ) );
+ ($origNote =~ m/^=?{\.\.r([^}]+)$/) and
+ return( &openNote( $notes{"{..r}"} . "(".&translateHebrewWordorNote($1) ." " ) );
+
($origNote =~ m/^([^{]+)}$/) and
- return( &closeNote("(".&translateHebrewWordorNote( $1 ).") ". $notes{ "{...}" }) );
+ return( &closeNote(&translateHebrewWordorNote( $1 ).")" ) );
+
- ($origNote =~ m/^@([?$hebrewLetters]+)/) and
+ ($origNote =~ m/^=?@([?$hebrewLetters]+)/) and
return( &createNote( $notes{ "=\@" } ) . &translateHebrewWordorNote( $1 ) );
- ($origNote =~ m/^\^([?$hebrewLetters]+)/) and
+ ($origNote =~ m/^=?\^([?$hebrewLetters]+)/) and
return( "^" . &translateHebrewWordorNote( $1 ) ); # TODO: check, what is ^?
#
# Special handling for the = colB Notes
#
if (($origNote =~ m/^=/) and (not $notes{ $origNote } )) { #only split if the note does not exist, to avoid parsing problems
- print("note reads $origNote\n");
+# print("note reads $origNote\n");
if ($origNote =~ m/^=(<[0-9.a-z]+>)$/){
return( &translateHebrewWordorNote( $1 ) );
}
@@ -300,16 +342,9 @@ sub translateHebrewNote(){
elsif ($origNote =~ m/^=([?$hebrewLetters]+)/){
return( &translateHebrewWordorNote( $1 ) );
}
- elsif ($origNote =~ m/^=([^?$hebrewLetters]+)([?$hebrewLetters]+)/){ #Note + Hebrew text, split up
- if ($notes{ $1 }){
- return( &translateHebrewNote( $1 ) . &translateHebrewWordorNote( $2 ) );
- }
- elsif( $notes{ "=$1" }){
- return( &translateHebrewNote( "=$1" ) . &translateHebrewWordorNote( $2 ) );
- }
- else { die("Could not parse note.\n"); }
+ else {
+ goto HANDLE_NOTE_FALLBACK; #try to split up the note
}
- else { die("Could not parse note.\n"); }
}
#special case: no note, but a crossref (no book ID) # TODO: for now OSIS refs are not parsed
@@ -334,26 +369,83 @@ sub translateHebrewNote(){
($origNote =~ m/^[?].*/) and
return( &createNote( $notes{"?"} ) . &translateHebrewWordorNote( $1 ) );
- ($notes{ $origNote }) and return( &createNote( $notes{$origNote} ) );
-
- for my $i ( 1 .. (length($origNote)-1) ){ #last try, split up into chunks
- if ( $notes{ substr($origNote,0,$i) } ){
- return( &translateHebrewNote(substr($origNote,0,$i)) . &translateHebrewWordorNote(substr($origNote,$i, length($origNote) - $i) ) );
+ HANDLE_NOTE_FALLBACK: for my $i ( 1..(length($origNote)-1) ){ #last try, split up into chunks
+ my $currentLength = length( $origNote ) - 1 - $i; #start with the longest and become shorter, to find the complicated notes {!}p before the simple {!}
+ if ( $notes{ substr($origNote,0,$currentLength) } ){
+ return( &translateHebrewNote(substr($origNote,0,$currentLength)) . &translateHebrewWordorNote(substr($origNote,$currentLength, length($origNote) - $currentLength) ) );
}
}
die("Note $origNote not found.\n");
}
-sub translateHebrewLetter(){ #will return unicode hebrew without morph separation
+sub translateHebrewLetters(){ #will return unicode hebrew without morph separation
my $hebrew = shift;
-
my $result;
- $result = $hebrew2utf8{ $hebrew } || die("Could not find Hebrew letter $hebrew\n");
+ (not $hebrew) and die "Hebrew string empty...\n";
+ foreach my $i (0..length( $hebrew )-1 ){
+ $result .= $hebrew2utf8{ substr($hebrew,$i,1) } || die("Could not find Hebrew letter $hebrew\n");
+ }
return $result;
}
+sub translateGreekNote(){
+ my $origNote = shift;
+
+ print("TranslateGreekNote $origNote\n");
+
+ ($notes{ $origNote }) and return( &createNote( $notes{$origNote} ) );
+
+ ($origNote =~ m/^\[(.+)\]/) and
+ return( &createNote( "Number of verse in LXX ($1) is different from MT." ) );
+
+ ($origNote =~ m/^\[\[(.+)\]\]/) and
+ return( &createNote( "Number of verse in MT ($1) is different from the LXX." ) );
+
+ ($origNote =~ m/^=?{\.\.p(.+)}/) and
+ return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..p}" }) );
+
+ ($origNote =~ m/^=?{\.\.d(.+)}/) and
+ return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..d}" }) );
+
+ ($origNote =~ m/^=?{\.\.\.d(.+)}/) and # TODO: my addition, check
+ return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..d}" }) );
+
+ ($origNote =~ m/^=?{\.\.(.+)}/) and
+ return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..}" }) );
+
+ ($origNote =~ m/^=?{c(.+)}/) and
+ return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{c}" }) ); # TODO: occurs {cXXX}, not documented
+
+ #Special cases: the note includes more than one word, "cat" the results together
+ ($origNote =~ m/^=?{\.\.d([^}]+)$/) and
+ return( &openNote( $notes{"{..d}"} . "(".&translateGreekWordorNote($1) ." " ) );
+ ($origNote =~ m/^=?{\.\.r([^}]+)$/) and
+ return( &openNote($notes{"{..r}"} . "(" .&translateGreekWordorNote($1) ." " ) );
+ ($origNote =~ m/^=?{\.\.p([^}]+)$/) and
+ return( &openNote($notes{"{..p}"} . "(" .&translateGreekWordorNote($1) ." " ) );
+ ($origNote =~ m/^=?{\.\.\.([^}]+)$/) and
+ return( &openNote($notes{"{...}"} . "(" .&translateGreekWordorNote($1) ." " ) );
+ ($origNote =~ m/^=?{\.\.([^}]+)$/) and
+ return( &openNote($notes{"{...}"} . "(" .&translateGreekWordorNote($1) ." " ) );
+ ($origNote =~ m/^=?{c([^}]+)$/) and
+ return( &openNote($notes{"{c}"} . "(" .&translateGreekWordorNote($1) ." " ) ); # TODO: occurs {cXXX}, not documented
+
+ ($origNote =~ m/^([^{]+)}$/) and
+ return( &closeNote(&translateGreekWordorNote( $1 ).")" ) );
+
+
+ HANDLE_NOTE_FALLBACK: for my $i ( 1..(length($origNote)-1) ){ #last try, split up into chunks
+ my $currentLength = length( $origNote ) - 1 - $i; #start with the longest and become shorter, to find the complicated notes {!}p before the simple {!}
+ if ( $notes{ substr($origNote,0,$currentLength) } ){
+ return( &translateGreekNote(substr($origNote,0,$currentLength)) . &translateGreekWordorNote(substr($origNote,$currentLength, length($origNote) - $currentLength) ) );
+ }
+ }
+ die("Note $origNote not found.\n");
+}
+
+
sub translateHebrewWordorNote(){ #will return unicode hebrew with morph separation
my $hebrew = shift;
@@ -363,7 +455,6 @@ sub translateHebrewWordorNote(){ #will return unicode hebrew with morph separati
( $hebrew =~ m/^[^$hebrewLetters]/ ) and return &translateHebrewNote( $hebrew );
( $hebrew =~ m/[}]$/ ) and return &translateHebrewNote( $hebrew );
-
my $length = length($hebrew);
my $index = 0;
my $result = $MorphologicalSegmentStart;
@@ -379,31 +470,30 @@ sub translateHebrewWordorNote(){ #will return unicode hebrew with morph separati
sub translateGreekWordorNote(){
- return; # TODO: remove
-
my $greek = shift;
- foreach my $key (keys %notes){
- if ( $greek eq $key ){ #we have a note and not a word
- return $notes{ $greek }; # TODO: format OSIS note
- }
- }
+ ( $greek =~ m/^[^$greekLetters]/ ) and return &translateGreekNote( $greek );
+ ( $greek =~ m/[}]$/ ) and return &translateGreekNote( $greek );
+ ( $greek eq "#" ) and return &translateGreekNote( $greek );
+
+ ( $greek =~ m/^(.+)(\[\d+\])$/ ) and return ( &translateGreekWordorNote( $1 ) . &translateGreekNote ( $2 ) );
+
my $length = length($greek);
my $index = 0;
- my $result ="";
+ my $result;
CHAR_LOOP: while ( $index < $length ) {
-# if ( $greek2utf8{ substr( $greek, $index, 1) } eq "*"){
-# die("FOUND capital character in $greek\n");
-# $result .= $greek2utf8{ substr( $greek, $index, 2) };
-# $index += 2;
-# }
-# else{
- my $gsubstr = substr( $greek, $index, 1);
-# $greek2utf8{ $gsubstr } or die("Could not find greek: $gsubstr\n");
+ my $gsubstr = substr( $greek, $index, 1);
+ if ($greek2utf8{ $gsubstr } ){
$result .= $greek2utf8{ $gsubstr };
- ++$index;
-# }
+ }
+ elsif ( $greek2utf8{ substr( $greek, $index, 2) } ){ #for the #3 letter
+ $result .= $greek2utf8{ substr( $greek, $index, 2) };
+ }
+ else{
+ die("Could not find greek: $gsubstr.\n")
+ }
+ ++$index;
}
return $result;
}
@@ -412,9 +502,10 @@ sub parseLine(){
my $origLine = shift;
my $result;
- printf("parsing %s\n", $origLine);
+ printf("parsing %s\n", $origLine);
$origLine =~ s/--=/--+ =/; # TODO: UGLY HACK, this appears in the text but not the notes; this seems most reasonable
+ $origLine =~ s/-\%vap/=\%vap/; # TODO: UGLY HACK, this appears in the text but not the notes; this seems most reasonable
($origLine =~ m/^([^=]+)?([=].+)?\t(.+)$/) or die("No match in parseLine().\n");
($1 or $2) or die("Hebrew not found.\n");
@@ -429,38 +520,28 @@ sub parseLine(){
$result .= "<row>\n <cell>";
foreach my $wordA (@hebrewWordsColA){
- $result .= &translateHebrewWordorNote( $wordA );
+ $result .= &translateHebrewWordorNote( $wordA ) . " ";
}
$result .= "</cell>\n <cell>";
foreach my $wordB (@hebrewWordsColB){
-# if ( $wordB =~ m/^=/ ){
-# $wordB =~ m/(=[^$hebrewLetters()]*)([$hebrewLetters].*)?/ or die("No match in ColB.\n"); #added ( and ) in the first expression, because they can occur in notes also
-# $1 and $result .= &translateHebrewWordorNote( $1 ); #This isolates the notes introducing colB (=*)
-# $result .= &translateHebrewWordorNote( $2 );
-# }
-# else {
- $result .= &translateHebrewWordorNote( $wordB );
-# }
+ $result .= &translateHebrewWordorNote( $wordB ) . " ";
}
$result .= "</cell>\n <cell>";
- my $index = 0;
foreach my $wordG (@greekWords){
- if ( $greekWords[$index] eq "{x}" ){ #special case: note containing a space, has to be handled together
+# if ( $greekWords[$index] eq "{x}" ){ #special case: note containing a space, has to be handled together
# $result .= &translateGreekWordorNote( "$wordG $greekWords[$index+1]" );
- $index += 2;
- }
- elsif ( $wordG eq "{x}" ){ #skip
- ++$index;
- }
- else{
-# $result .= &translateGreekWordorNote( $wordG );
- ++$index;
- }
+# $index += 2;
+# }
+# elsif ( $wordG eq "{x}" ){ #skip
+# ++$index;
+# }
+# else{
+ $result .= &translateGreekWordorNote( $wordG ). " ";
}
- $result .= " </cell>\n</row>";
-# printf("Result: %s\n", $result);
+ $result .= "</cell>\n</row>";
+# printf("Result: %s\n", $result);
return $result;
}
@@ -509,8 +590,7 @@ sub processBook(){
my $osis_id = shift;
my $short_book_title = shift;
- open( FILE, "$prefix/$filename") or die("Could not open file $prefix/$filename");
- my @BUF = <FILE>; chomp(@BUF); close( FILE );
+ my @BUF = &loadFile( $filename );
my @result;
@@ -598,21 +678,49 @@ sub processBookVariant(){
}
-sub fixDaniel(){ #@buffer
- my @buffer = @_;
+sub loadFile(){ #$fileName loads the file into the buffer and makes small corrections
+ my $filename = shift;
+
+ open( FILE, "$prefix/$filename") or die("Could not open file $prefix/$filename");
+ my @buffer = <FILE>; chomp(@buffer); close( FILE );
+
my @result;
my $index = 0;
- foreach my $currentItem (@buffer){
- if ($buffer[$index] =~ m/^DANIHL/){}#Do not add this line to the result
- else{
- if ($buffer[$index + 1] =~ m/^DANIHL/){ #Push both lines on one
- push(@result, $buffer[$index] . $buffer[$index +1] );
+ if (($filename eq "45.DanielOG.par") or($filename eq "46.DanielTh.par")){ #several places where DANIHL has to to on the preceding line
+ foreach my $currentItem (@buffer){
+ if ($buffer[$index] =~ m/^DANIHL/){
+ $result[$#result-1] .= " DANIHL";
}
else{
- push(@result, $buffer[$index] ); #The normal case
+ push(@result, $buffer[$index] );
}
+ $index++;
}
- $index++;
+ }
+ elsif ($filename eq "04.Num.par"){ #fix for Numeri, one time where NUMA has to go on the preceding line, no space
+ foreach my $currentItem (@buffer){
+ if ($buffer[$index] =~ m/^NUMA/){
+ $result[$#result-1] .= "NUMA";
+ }
+ else{
+ push(@result, $buffer[$index] );
+ }
+ $index++;
+ }
+ }
+ elsif ($filename eq "05.Deut.par"){ #fix for Numeri, one time where NUMA has to go on the preceding line, no space
+ foreach my $currentItem (@buffer){
+ if ($buffer[$index] =~ m/^DEUTERONO\/MION/){
+ $result[$#result-1] .= " DEUTERONO/MION";
+ }
+ else{
+ push(@result, $buffer[$index] );
+ }
+ $index++;
+ }
+ }
+ else{
+ @result = @buffer;
}
return @result;
}
@@ -621,55 +729,52 @@ my @result;
# File File id ThML id OSIS id Short Book Title
-push(@result, &processBook("01.Genesis.par", "Gen", "Gen", "Gen", "Genesis") );
-die "Finished Genesis\n";
-
-push(@result, &processBook("02.Exodus.par", "Exod", "Exod", "Exod", "Exodus") );
-push(@result, &processBook("03.Lev.par", "Lev", "Lev", "Lev", "Leviticus") );
-push(@result, &processBook("04.Num.par", "Num", "Num", "Num", "Numbers") );
-push(@result, &processBook("05.Deut.par", "Deut", "Deut", "Deut", "Deuteronomy") );
-
+#push(@result, &processBook("01.Genesis.par", "Gen", "Gen", "Gen", "Genesis") );
+#push(@result, &processBook("02.Exodus.par", "Exod", "Exod", "Exod", "Exodus") );
+#push(@result, &processBook("03.Lev.par", "Lev", "Lev", "Lev", "Leviticus") );
+#push(@result, &processBook("04.Num.par", "Num", "Num", "Num", "Numbers") );
+#push(@result, &processBook("05.Deut.par", "Deut", "Deut", "Deut", "Deuteronomy") );
push(@result, &processBookVariant("07.JoshA.par", "JoshA", "Codex Alexandrinus:", "06.JoshB.par", "JoshB", "Codex Vaticanus:", "Josh", "Josh", "Joshua") );
push(@result, &processBookVariant("09.JudgesA.par", "JudgA", "Codex Alexandrinus:", "08.JudgesB.par", "JudgB", "Codex Vaticanus:", "Judg", "Judg", "Judges") );
-
-push(@result, &processBook("10.Ruth.par", "Ruth", "Ruth", "Ruth", "Ruth") );
-push(@result, &processBook("11.1Sam.par", "1Sam/K", "iSam", "1Sam", "1 Samuel") );
-push(@result, &processBook("12.2Sam.par", "2Sam/K", "iiSam", "2Sam", "2 Samuel") );
-push(@result, &processBook("13.1Kings.par", "1/3Kgs", "iKgs", "1Kgs", "1 Kings") );
-push(@result, &processBook("14.2Kings.par", "2/4Kgs", "iiKgs", "2Kgs", "2 Kings") );
-push(@result, &processBook("15.1Chron.par", "1Chr", "iChr", "1Chr", "1 Chronicles") );
-push(@result, &processBook("16.2Chron.par", "2Chr", "iiChr", "2Chr", "2 Chronicles") );
-push(@result, &processBook("18.Ezra.par", "Ezr", "Ezra", "Ezra", "Ezra") );
-push(@result, &processBook("19.Neh.par", "Neh", "Neh", "Neh", "Nehemiah") );
-push(@result, &processBook("18.Esther.par", "Esth", "Esth", "Esth", "Esther") );
-push(@result, &processBook("26.Job.par", "Job", "Job", "Job", "Job") );
-
- #This might need special handling
- #push(@result, &processBook("Psalms.par", "Ps", "Ps", "Ps", "Psalms",
-
-push(@result, &processBook("23.Prov.par", "Prov", "Prov", "Prov", "Proverbs") );
-push(@result, &processBook("24.Qoh.par", "Qoh", "Eccl", "Eccl", "Ecclesiastes") );
-push(@result, &processBook("25.Cant.par", "Song", "Song", "Song", "Song of Solomon") );
-push(@result, &processBook("40.Isaiah.par", "Isa", "Isa", "Isa", "Isaiah") );
-push(@result, &processBook("41.Jer.par", "Jer", "Jer", "Jer", "Jeremiah") );
-push(@result, &processBook("43.Lam.par", "Lam", "Lam", "Lam", "Lamentations") );
-push(@result, &processBook("44.Ezekiel.par", "Ezek", "Ezek", "Ezek", "Ezekiel") );
-
-my @danielTmp = &processBookVariant("45.DanielOG.par", "Dan", "Old Greek:", "46.DanielTh.par", "DanTh", "Theodotion:", "Dan", "Dan", "Daniel");
-push(@result, &fixDaniel( @danielTmp ) );
-
-push(@result, &processBook("28.Hosea.par", "Hos", "Hos", "Hos", "Hosea") );
-push(@result, &processBook("31.Joel.par", "Joel", "Joel", "Joel", "Joel") );
-push(@result, &processBook("30.Amos.par", "Amos", "Amos", "Amos", "Amos") );
-push(@result, &processBook("33.Obadiah.par", "Obad", "Obad", "Obad", "Obadiah") );
-push(@result, &processBook("32.Jonah.par", "Jonah", "Jonah", "Jonah", "Jonah") );
-push(@result, &processBook("29.Micah.par", "Mic", "Mic", "Mic", "Micah") );
-push(@result, &processBook("34.Nahum.par", "Nah", "Nah", "Nah", "Nahum") );
-push(@result, &processBook("35.Hab.par", "Hab", "Hab", "Hab", "Habakkuk") );
-push(@result, &processBook("36.Zeph.par", "Zeph", "Zeph", "Zeph", "Zephaniah") );
-push(@result, &processBook("37.Haggai.par", "Hag", "Hag", "Hag", "Haggai") );
-push(@result, &processBook("38.Zech.par", "Zech", "Zech", "Zech", "Zechariah") );
-push(@result, &processBook("39.Malachi.par", "Mal", "Mal", "Mal", "Malachi") );
+#
+# push(@result, &processBook("10.Ruth.par", "Ruth", "Ruth", "Ruth", "Ruth") );
+# push(@result, &processBook("11.1Sam.par", "1Sam/K", "iSam", "1Sam", "1 Samuel") );
+# push(@result, &processBook("12.2Sam.par", "2Sam/K", "iiSam", "2Sam", "2 Samuel") );
+# push(@result, &processBook("13.1Kings.par", "1/3Kgs", "iKgs", "1Kgs", "1 Kings") );
+# push(@result, &processBook("14.2Kings.par", "2/4Kgs", "iiKgs", "2Kgs", "2 Kings") );
+# push(@result, &processBook("15.1Chron.par", "1Chr", "iChr", "1Chr", "1 Chronicles") );
+# push(@result, &processBook("16.2Chron.par", "2Chr", "iiChr", "2Chr", "2 Chronicles") );
+# push(@result, &processBook("18.Ezra.par", "Ezr", "Ezra", "Ezra", "Ezra") );
+# push(@result, &processBook("19.Neh.par", "Neh", "Neh", "Neh", "Nehemiah") );
+# push(@result, &processBook("18.Esther.par", "Esth", "Esth", "Esth", "Esther") );
+# push(@result, &processBook("26.Job.par", "Job", "Job", "Job", "Job") );
+#
+# #This might need special handling
+# #push(@result, &processBook("Psalms.par", "Ps", "Ps", "Ps", "Psalms",
+#
+# push(@result, &processBook("23.Prov.par", "Prov", "Prov", "Prov", "Proverbs") );
+# push(@result, &processBook("24.Qoh.par", "Qoh", "Eccl", "Eccl", "Ecclesiastes") );
+# push(@result, &processBook("25.Cant.par", "Song", "Song", "Song", "Song of Solomon") );
+# push(@result, &processBook("40.Isaiah.par", "Isa", "Isa", "Isa", "Isaiah") );
+# push(@result, &processBook("41.Jer.par", "Jer", "Jer", "Jer", "Jeremiah") );
+# push(@result, &processBook("43.Lam.par", "Lam", "Lam", "Lam", "Lamentations") );
+# push(@result, &processBook("44.Ezekiel.par", "Ezek", "Ezek", "Ezek", "Ezekiel") );
+#
+# my @danielTmp = &processBookVariant("45.DanielOG.par", "Dan", "Old Greek:", "46.DanielTh.par", "DanTh", "Theodotion:", "Dan", "Dan", "Daniel");
+# push(@result, &fixDaniel( @danielTmp ) );
+#
+# push(@result, &processBook("28.Hosea.par", "Hos", "Hos", "Hos", "Hosea") );
+# push(@result, &processBook("31.Joel.par", "Joel", "Joel", "Joel", "Joel") );
+# push(@result, &processBook("30.Amos.par", "Amos", "Amos", "Amos", "Amos") );
+# push(@result, &processBook("33.Obadiah.par", "Obad", "Obad", "Obad", "Obadiah") );
+# push(@result, &processBook("32.Jonah.par", "Jonah", "Jonah", "Jonah", "Jonah") );
+# push(@result, &processBook("29.Micah.par", "Mic", "Mic", "Mic", "Micah") );
+# push(@result, &processBook("34.Nahum.par", "Nah", "Nah", "Nah", "Nahum") );
+# push(@result, &processBook("35.Hab.par", "Hab", "Hab", "Hab", "Habakkuk") );
+# push(@result, &processBook("36.Zeph.par", "Zeph", "Zeph", "Zeph", "Zephaniah") );
+# push(@result, &processBook("37.Haggai.par", "Hag", "Hag", "Hag", "Haggai") );
+# push(@result, &processBook("38.Zech.par", "Zech", "Zech", "Zech", "Zechariah") );
+# push(@result, &processBook("39.Malachi.par", "Mal", "Mal", "Mal", "Malachi") );
print( join("\n", @result) );