[sword-svn] r55 - trunk/modules/mt-lxx-parallel

mgruner at crosswire.org mgruner at crosswire.org
Fri Dec 2 04:16:00 MST 2005


Author: mgruner
Date: 2005-12-02 04:15:52 -0700 (Fri, 02 Dec 2005)
New Revision: 55

Modified:
   trunk/modules/mt-lxx-parallel/convert.pl
Log:
fixed bad bug
entire OT parses (except Apocrypha)
now need to work on the output...



Modified: trunk/modules/mt-lxx-parallel/convert.pl
===================================================================
--- trunk/modules/mt-lxx-parallel/convert.pl	2005-11-23 22:53:41 UTC (rev 54)
+++ trunk/modules/mt-lxx-parallel/convert.pl	2005-12-02 11:15:52 UTC (rev 55)
@@ -195,6 +195,7 @@
 "{p}+" => "Greek preverb representing Hebrew preposition.",  # TODO: my addition ???
 "{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.",
+"{...p}" => "Preposition added in the LXX in accordance with the rules of the Greek language or translational habits.", #my addition
 "{..^{p}" => "Preposition added in the LXX in accordance with the rules of the Greek language or translational habits.", #my addition
 
 "{+}" => "Unknown.", # TODO: occurs in the text, unknown meaning
@@ -327,7 +328,7 @@
 sub translateHebrewNote(){
 	my $origNote = shift;
 
-	print("TranslateHebrewNote $origNote\n");
+#	print("TranslateHebrewNote $origNote\n");
 
 	($origNote eq "=") and return;	#= only marks colB, no real note
 
@@ -435,7 +436,7 @@
 sub translateGreekNote(){
 	my $origNote = shift;
 
-	print("TranslateGreekNote $origNote\n");
+#	print("TranslateGreekNote $origNote\n");
 
 	($notes{ $origNote }) and return( &createNote( $notes{$origNote} ) );
 
@@ -450,7 +451,7 @@
 		return $origNote;
 
 	#special case: no note, but a crossref (no book ID)     # TODO: for now OSIS refs are not parsed FIX THIS, see above
- 	($origNote =~ m/^\[.+$/) and
+ 	($origNote =~ m/^\[.+$|\d+\]$/) and     #e.g. [119. 7], [111.2
 		return $origNote;
 
 	($origNote =~ m/^=?{\.\.\.(.+)\.\.\.(.+)}/) and  # special case: {...word1...word2}
@@ -460,6 +461,9 @@
 	($origNote =~ m/^=?{\.\.p(.+)}/) and 
 		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..p}" }) );
 
+	($origNote =~ m/^=?{\.\.\.p(.+)}/) and 
+		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{...p}" }) );
+
 	($origNote =~ m/^=?{\.\.\.r(.+)}/) and 
 		return( &createNote("(".&translateGreekWordorNote( $1 ).") ". $notes{ "{..r}" }) );
 
@@ -564,7 +568,7 @@
 
 	my $greek = shift;
 
-	printf("TranslateGreek of $greek\n");
+#	printf("TranslateGreek of $greek\n");
 
 	( $notes {$greek} ) and return &translateGreekNote( $greek ); # exact match first
 
@@ -601,7 +605,7 @@
 	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
@@ -616,6 +620,13 @@
 
 	$origLine =~ s/^\(..r\(L\/YK}/{..r(L\/YK}/; # in EZEK
 
+	$origLine =~ s/^DANW {t}$/DANW\t{t}/; # in DAN
+
+	$origLine =~ s/AI\)W=NOS\[110\.10/AI)W=NOS [110.10/; # in PS
+	$origLine =~ s/W\/YD\(Y{\*\*}/W\/YD(Y {**}/; # in PS
+	$origLine =~ s/{\.1\.dU\(PE\\R}/{..dU(PE\R}/; # in PS
+
+
 	$origLine =~ m/^W\(\/SPER/ and return;	#ignore, probably an error
 
 	($origLine eq "W/)T H/GRG\$Y ^ =W/)T W/H/)MRY KAI\\ TO\\N AMORRAI=ON ") and 
@@ -678,7 +689,7 @@
 
 	my $index=0;
 
-	printf("Parsing $bookname $chapter:$verse...\n");
+#	printf("Parsing $bookname $chapter:$verse...\n");
 
 	if ($bookname eq "Obad"){ #special handling, no chapter:verse structure
 		LOOP: foreach my $current_item (@buffer){
@@ -725,12 +736,13 @@
 			my @verseContent = &grabVerseContent($bookname_infile, $chapter, $verse, @BUF);
 			if (@verseContent) {
 				if ($bookname_infile eq "Obad"){
-					push(@result, "$osis_id $verse"); #chapter will be ignored for >1 by grabVerseContent
+					push(@result, "<verse osisID=\"$osis_id.$verse\">"); #chapter will be ignored for >1 by grabVerseContent
 				}
 				else{
-					push(@result, "$osis_id $chapter:$verse");
+					push(@result, "<verse osisID=\"$osis_id.$chapter.$verse\">");
 				}
 				push(@result, @verseContent);
+				push(@result, "</verse>");
 				$verse_found = 1;
 			}
 			else{ #verse nonexistent, goto next chapter
@@ -759,14 +771,9 @@
 	my $osis_id = shift;
 	my $short_book_title = shift;
 
-#	print("Processing $booknameA $filenameA $booknameB $filenameB $neutralBookname... \n");
+	my @BUFA = loadFile( "$filenameA" );
+	my @BUFB = loadFile( "$filenameB" );
 
-	open( FILE, "$prefix/$filenameA") or die("Could not open file $prefix/$filenameA");
-	my @BUFA = <FILE>; chomp(@BUFA); close( FILE );
-
-	open( FILE, "$prefix/$filenameB") or die("Could not open file $prefix/$filenameB");
-	my @BUFB = <FILE>; chomp(@BUFB); close( FILE );
-
 	my @result;
 
 	CHAPTER: foreach my $chapter(1..1000){
@@ -776,7 +783,7 @@
 			my @verseContentA = &grabVerseContent($bookname_infile_A, $chapter, $verse, @BUFA);
 			my @verseContentB = &grabVerseContent($bookname_infile_B, $chapter, $verse, @BUFB);
 			if (@verseContentA or @verseContentB) { 
-				push(@result, "$osis_id $chapter:$verse");
+				push(@result, "<verse osisID=\"$osis_id.$chapter.$verse\">");
 				$verse_found = 1;
 			}
 			else{ #verse nonexistent, goto next chapter
@@ -785,12 +792,13 @@
 			if (@verseContentA){
 				if (@verseContentB){ push(@result, $variantNameA) };
 				push(@result, @verseContentA);
-				if (@verseContentB){ push(@result, "") };
+				if (@verseContentB){ push(@result, "") }; #newline
 			}
 			if (@verseContentB){
 				if (@verseContentA){ push(@result, $variantNameB) };
 				push(@result, @verseContentB);
 			}
+			if ($verse_found){ push(@result, "</verse>") }
 		}
 		if (not $verse_found){ #chapter empty, stop here
 			if ($chapter == 1) { die("Error: no content in $bookname_infile_A and $bookname_infile_B"); }
@@ -812,41 +820,53 @@
 	my $index = 0;
 	foreach my $currentItem (@buffer){
 		if ($buffer[$index] =~ m/^DANIHL/){
-			$result[$#result-1] .= " ".$buffer[$index];
+			$result[$#result] .= " " .$buffer[$index];
 		}
 		elsif ($buffer[$index] =~ m/^NUMA/){
-			$result[$#result-1] .= $buffer[$index];
+			$result[$#result] .= $buffer[$index];
 		}
 		elsif ($buffer[$index] =~ m/^DEUTERONO\/MION/){
-			$result[$#result-1] .= " ".$buffer[$index];
+			$result[$#result] .= " ".$buffer[$index];
 		}
 		elsif ($buffer[$index] =~ m/^AU\)TOU=/){
-			$result[$#result-1] .= " ".$buffer[$index];
+			$result[$#result] .= " ".$buffer[$index];
 		}
 		elsif ($buffer[$index] =~ m/^E\(\/C/){
-			$result[$#result-1] .= " ". $buffer[$index];
+			$result[$#result] .= " ". $buffer[$index];
 		}
 		elsif ($buffer[$index] =~ m/^MOU/){
-			$result[$#result-1] .= " " . $buffer[$index];
+			$result[$#result] .= " " . $buffer[$index];
 		}
 		elsif ($buffer[$index] =~ m/^NEHL$/){
-			$result[$#result-1] .= $buffer[$index]; # no space, ANANEL
+			$result[$#result] .= $buffer[$index]; # no space, ANANEL
 		}
 		elsif ($buffer[$index] =~ m/^ESTHKE\/NAI$/){
-			$result[$#result-1] .= $buffer[$index]; # no space
+			$result[$#result] .= $buffer[$index]; # no space
 		}
 		elsif ($buffer[$index] =~ m/^ESTHKW\\S$/){
-			$result[$#result-1] .= $buffer[$index]; # no space
+			$result[$#result] .= $buffer[$index]; # no space
 		}
 		elsif ($buffer[$index] =~ m/^ISA/){	# a few lines in ISAIAH have this in different styles
-			$result[$#result-1] .= $buffer[$index]; # no space
+			$result[$#result] .= $buffer[$index]; # no space
 		}
 		elsif ($buffer[$index] =~ m/^LAMYAN/){	# in LAM
-			$result[$#result-1] .= $buffer[$index]; # no space
+			$result[$#result] .= $buffer[$index]; # no space
 		}
 		elsif ($buffer[$index] =~ m/^EZEKIHL/){	# in LAM
-			$result[$#result-1] .= $buffer[$index]; # no space
+			$result[$#result] .= $buffer[$index]; # no space
 		}
+		elsif ($buffer[$index] =~ m/^\)$/){	# in PS
+			$result[$#result] .= $buffer[$index]; # no space
+		}
+		elsif ($buffer[$index] =~ m/^PS[Y\s]/){	# in PS; breaks at PS or PSY
+			$result[$#result] .= $buffer[$index]; # no space
+		}
+		elsif (($buffer[$index+1] =~ m/^#/) && ($buffer[$index] =~ m/^(.*)#$/)){	# in Daniel, # is used as a "continue line on next line" marker
+			push(@result, $1);
+		}
+		elsif (($buffer[$index-1] =~ m/^(.*)#$/) && $buffer[$index] =~ m/^#\t(.*)/){ # in Daniel, # is used as a "continue line on next line" marker
+			$result[$#result] .= $1;
+		}
 		else{
 			push(@result, $buffer[$index] );
 		}
@@ -880,7 +900,7 @@
 # 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("20.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") );
@@ -890,13 +910,13 @@
 # push(@result, &processBook("43.Lam.par", "Lam", "Lam", "Lam", "Lamentations") );
 # push(@result, &processBook("44.Ezekiel.par", "Ezek", "Ezek", "Ezek", "Ezekiel") );
 # 
- push(@result, &processBookVariant("45.DanielOG.par", "Dan", "Old Greek:", "46.DanielTh.par", "DanTh", "Theodotion:", "Dan", "Dan", "Daniel"));
+# push(@result, &processBookVariant("45.DanielOG.par", "Dan", "Old Greek:", "46.DanielTh.par", "DanTh", "Theodotion:", "Dan", "Dan", "Daniel"));
 # 
 # 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("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") );



More information about the sword-cvs mailing list