OTA BHS Conversion runaround

Henry Churchyard churchh at usa.net
Sun Oct 29 16:14:02 EST 2000


I looked more closely at the OTA website in its newer and more bloated
reincarnation (fragilely held together with baling wire, duct tape, and
excessive use of browser-dependent javascript), and figured out how to
get the BHS text from that site in a form which can be processed by the
appropriate programs; the key is to be very careful at every single
step along the way that no program is "helpfully" reformatting the text
behind your back.

First, go to the page on on which all the variant forms of the BHS text
offered for download are listed.  (Get there from the front page
http://ota.ahds.ac.uk/ by searching on "Stuttgartensia", then clicking
on "Get Text".)  What you want to try to do at this point is to
download the most "minimal" plain text version as a raw binary download
(without being reformatted by software); what you definitely do _not_
want to do is to get the HTML-formatted version -- or to allow any of
the versions to be opened and viewed within a browser window (where the
browser might interpret it as text and re-format it) and then be saved
to a file from within the browser window.  The best thing is to _right_
click on the link for downloading the most basic "minimal" plaintext
version, and tell the browser to do a "Save Link to File" (this is what
Netscape calls it; other browsers may have a slightly different
terminology), so that the file "ascii-0525-1.txt" is downloaded to your
hard disk without having been viewed within a browser window.
Unfortunately, because of the brittle Javascript and other finicky and
poorly-implemented programming on which the OTA website critically
depends, right-clicking may not work for you (it worked for me once in
Netscape, but not the subsequent times I tried it with Netscape or MSIE,
that's all I can say).  If you have a simple URL-getting program, that
downloads the contents of a URL to disk without doing any formatting or
processing of the results, then you can use it to get the following
URL (where "your at email" should be replaced with your e-mail address):
http://ota.ahds.ac.uk/texts/ascii-0525-1.txt?agree=127&email=your@email&parts=_ascii-0525-1__dosascii-0525-1__html-0525-1_
There are a number of such URL-getting programs for various platforms,
and it's almost trivial to write a routine in Perl.  Also, if you have
access to a Unix/Linux "shell" account on a machine connected to the Internet, 
the Lynx program can be used as a raw binary URL getter in the following way 
(add an ampersand to the end of the Unix command line to download in 
background): 

lynx -source 'http://ota.ahds.ac.uk/texts/ascii-0525-1.txt?agree=127&email=your@email&parts=_ascii-0525-1__dosascii-0525-1__html-0525-1_' > ascii-0525-1.txt 

Assuming you've managed to do a straight raw binary download of the
file ascii-0525-1.txt (with no text reformatting), what you should
have is a file 3,406,236 bytes in length with LF linebreaks only
(i.e. ASCII character 10 marking ends of lines).  (The exact size
might not be the same in future, since the OTA people might choose to
further monkey with the SGML garbage that they've attached to the
beginning of the file at any time.)  On a DOS/Windows system, the
presence of LF characters only as linebreaks is a good confirmation
that you've gotten a straight binary download.  There are a number of
ways to add in CR characters (ASCII 13) to get the CR-LF linebreaks
that DOS/Windows programs expect; I used an old DOS program that I've
been using for almost ten years, "flip", available at
http://www.simtel.net/pub/simtelnet/msdos/txtutl/flip1exe.zip or
ftp://ftp.digital.com/pub/micro/pc/simtelnet/msdos/txtutl/flip1exe.zip
etc.  Open a DOS window and type a command line of
"flip -m ascii-~1.txt" (or whatever the short filename counterpart of
"ascii-0525-1.txt" is, since this is an older program that does not
understand long filenames), and the file size of ascii-0525-1.txt
should get bigger due to the CR's added in (I ended up with a file
size of 3,500,419 bytes).  This step might be omitted if you download
from OTA the version of the text that's supposedly been pre-formatted
for MS-DOS, but I'm not sure that this is what the supposed "MS-DOS
version" actually is (the description "DOC format" does not sound very
promising), and anyway downloading the version without CR's, and then
seeing that it has no CR's as originally downloaded, is one way of
making sure that your browser has done a straight raw binary download,
and hasn't tried to do any text reformatting or anything else fancy
with the file.

The next step is to strip away the SGML header from the beginning of
the file.  At present, exactly 5,356 bytes should be removed from the
beginning of the file (but again, this may change in the future if the
OTA people tinker with the SGML header); in any case, the goal is to
remove everything before the first "~c" character sequence, so that
this "~c" is at the very beginning of the first line of the file.
Don't try to strip away this material in your word-processor unless
you're very confident that your word-processor can work as an
industrial-strength text editor (i.e. handling a 3-megabyte file
without inserting any word-processor codes, or doing any text
reformatting or line-wrapping whatsoever); the GNU Emacs editor should
work fine, but I would be rather hesitant about trying to do this in
Microsoft Word, for example.  Again, I have an old DOS program I use
(these programs don't have fancy interfaces, but on the other hand
they're small, each of them does one thing simply and well, and they
don't try to outsmart you or do things behind your back, so that their
output is always completely predictable); this is "chop", available
from http://www.simtel.net/pub/simtelnet/msdos/fileutil/chop31.zip
etc.  Open a DOS window, type a command line
"chop31 -p1 -z -b5357 ascii-~1.txt" (or whatever the short filename
counterpart of "ascii-0525-1.txt" is), and you should get a file named
something like ASCII-~1.1 as output (which you can rename to something
more aesthetic) that is exactly 3,495,063 bytes in length.

This file should be exactly identical to the original BHS text file
which is among the material included in the ZIP archive at
http://www.pemberley.com/janeinfo/bigpersonal/bhs-text.zip -- except
that the garbage characters "</TEXT></TEI.2>" will occur at the very
end of the file (without a linebreak after them, unless you've used a
text-editor program which has added a linebreak at the end, in which
case the file should be 3,495,065 bytes in length); if these characters
cause problems for software programs that parse the BHS text, then they
could be stripped away too (in your industrial-strength text editor, or
with CHOP31.EXE) -- but they shouldn't have any effect on anything
other than the last verse of 2 Chronicles in any case.

--
Henry Churchyard   churchh at usa.net   http://www.crossmyt.com/hc/



More information about the b-hebrew mailing list