Converting SFM Bibles to OSIS
Standard Format Markers (SFM) and its more standardized derivative USFM have been used for decades to store Bibles for printing and display in programs like UBS' Paratext. The format is popular among Bible translation agencies and Bible societies. The basic format of SFM is simply plaintext with backslash(\) codes. For example, a new Bible verse is signaled by \v followed by the number of the verse.
Older texts in various dialects of SFM can still be found. It was common for various agencies, Bible societies, and even regional offices of such groups to have their own SFM standards. Unified Standard Format Markers (USFM) was developed to standardize SFM and encourage interoperability so that Bibles from one agency could be reasonably expected to operate with the software and stylesheets employed by another. The current version of USFM is 2.2, defined at http://confluence.ubs-icap.org/display/USFM/Home.
Preparing (U)SFM files for conversion
The simplicity of writing SFM also makes it easy to write poor SFM that fails to correspond to any kind of standard. The first task in preparing to convert SFM files to OSIS is to clean the text. The more regular your source files are, the more likely the conversion process will operate correctly.
One method of cleaning up your files is to import them into an SFM editor such as Bibledit (which runs on Linux, Mac OS X, and Windows) or SIL FieldWorks Translation Editor (which runs on Windows). The editors will frequently perform some basic corrections to the SFM syntax, but Bibledit in particular can perform a number of checks to correct specific errors common to SFM.
Converting USFM files to OSIS
There exist two publicly distributed programs capable of converting USFM files to OSIS: usfm2osis.pl and SFMToOSIS.
SFMToOSIS is the method of converting SFM & USFM files to OSIS XML files that CrossWire recommends. It is a robust, but somewhat difficult to setup and use, program produced by Snowfall Software. The program requires that you install a Python interpreter and that the interpreter be within the system path.
The program also requires a Paratext .ssf file. If you do not have such a file, you can use the following sample and adjust it to the specifics of your own text:
<ScriptureText> <BooksPresent>111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000</BooksPresent> <Encoding>UTF-8</Encoding> <ChapterMarker>c</ChapterMarker> <Copyright></Copyright> <FileNameForm>41MAT</FileNameForm> <FileNamePostPart>.SFM</FileNamePostPart> <FileNamePrePart></FileNamePrePart> <FullName>The Bible in English</FullName> <Language>ENGLISH</Language> <LeftToRight>T</LeftToRight> <Name>EN</Name> <VerseMarker>v</VerseMarker> <Versification>4</Versification> </ScriptureText>
Next, update the run.bat file that came with SFMToOSIS to point to your SFM files and SSF file. Then run run.bat.
usfm2osis.pl is a simple Perl script intended only for converting USFM files to OSIS. It is not as robust as SFMToOSIS and is less likely to produce valid OSIS files automatically. If it works for you, that's great, but you may find that using SFMToOSIS produces cleaner OSIS output.
usfm2osis.pl requires a Perl interpreter in the system path. Then you can run:
perl usfm2osis.pl <osisWork> [-o OSIS-file] [-e USFM encoding] <USFM filenames|wildcard>
osisWork should be a value such as Bible.en.WEB.2007.
If you include an OSIS-file value, the output will be written there. Otherwise, it will be written to a file name based on your osisWork.
The USFM encoding argument should indicate the character encoding found in the source files. If none is give, utf8 is the default. The list of available encodings depends on your system. Executing the script with no arguments will print the list (as will executing it with an invalid encoding value).
The final argument is a list of filenames or a wildcard value such as *.sfm containing the SFM data.
Importing OSIS files into SWORD
Before you import your OSIS files to SWORD format, you should check that it is valid OSIS. (And before you submit any files to firstname.lastname@example.org, you must ensure that your files are valid OSIS. Invalid OSIS files will not be accepted.) See OSIS Bible validation for further instructions on OSIS validation.
Instructions for running osis2mod are available at osis2mod usage.