Difference between revisions of "TEI Dictionaries"

From CrossWire Bible Society
Jump to: navigation, search
m (fixed the wrong statement about ordering!)
(Other helpful sites: https://www.teibyexample.org/exist/examples/)
 
(47 intermediate revisions by 6 users not shown)
Line 1: Line 1:
=Introduction=
+
==Introduction==
In Sword, the "LD" module type is used to contain modules keyed to non-hierarchical keys. Such modules include: dictionaries (indexed by words or numbers), glossaries (simple one-word translation dictionaries), and daily devotionals (indexed by dates).
+
In SWORD, the "LD" module type is used to contain modules keyed to non-hierarchical keys. Such modules include: dictionaries (indexed by words or numbers), glossaries (simple one-word translation dictionaries), and daily devotionals (indexed by dates).
  
For lexicons and dictionaries, the use of TEI P5 markup is encouraged. TEI P5 is an XML standard, quite similar to OSIS and ThML, intended for encoding all types of electronic documents. Since TEI is modular, it is possible to ignore the majority of its modules and use only the much simpler set of tags included in the core, dictionaries, and linking modules.
+
For lexicons and dictionaries, the use of [http://www.tei-c.org/Guidelines/P5/ Text Encoding Initiative P5] markup is encouraged. TEI P5 is an XML standard, quite similar to OSIS and ThML, intended for encoding all types of electronic documents. Since TEI is modular, it is possible to ignore the majority of its modules and use only a smaller set of tags necessary to our needs.
  
For the purpose using TEI P5 in Sword, we have developed a special XML Schema that includes the basic set of P5 modules necessary for dictionaries and adds osisID and osisRef attributes (with their normal OSIS syntax) to many elements. This will permit cross-referencing with OSIS modules and the use of standard Bible references in TEI documents. Our customized TEI schema is available at http://www.crosswire.org/osis/teiP5DictOsis.1.1.xsd.
+
For the purpose using TEI P5 in SWORD, we have developed a special XML Schema that includes the basic set of P5 modules necessary for dictionaries and adds osisID and osisRef attributes (with their normal OSIS syntax) to many elements. This will permit cross-referencing with OSIS modules and the use of standard Bible references in TEI documents. Our customized TEI schema is available at http://www.crosswire.org/OSIS/teiP5osis.2.5.0.xsd.
  
=Order=
+
==Order==
Sword uses a strict binary search to find entries and nearest entries in a "LD" module. There are two restrictions that this places upon a TEI dictionary:
+
SWORD uses a strict binary search to find entries and nearest entries in a "LD" module. There are two restrictions that this places upon a TEI dictionary:
  
 
1) Keys are unique and cannot be repeated. This poses problems with some dictionaries that have more than 1 entry for a key. These will need to be merged.
 
1) Keys are unique and cannot be repeated. This poses problems with some dictionaries that have more than 1 entry for a key. These will need to be merged.
Line 13: Line 13:
 
2) Entries will be re-ordered (by the importer utility) based upon their UTF-8 code points. Fortunately this turns out to be identical to a simple 8-bit ASCII collation.
 
2) Entries will be re-ordered (by the importer utility) based upon their UTF-8 code points. Fortunately this turns out to be identical to a simple 8-bit ASCII collation.
  
=Markup=
+
Note: Some characters can be composed or decomposed. The tei2mod importer will normalize to NFC using ICU. Any program that does not normalize its search request in exactly the same way cannot be expected to find entries.
  
==Linking Entries==
+
==General Structure==
There are three kinds of references in a Biblical dictionary:
+
 
 +
To produce a Lexicon/Dictionary with our customized TEI Schema, you can use this template:
 +
<pre>
 +
<?xml version="1.0" encoding="utf-8"?>
 +
<TEI xmlns="http://www.crosswire.org/2013/TEIOSIS/namespace"
 +
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 +
      xsi:schemaLocation="http://www.crosswire.org/2013/TEIOSIS/namespace
 +
                          http://www.crosswire.org/OSIS/teiP5osis.2.5.0.xsd">
 +
</pre>
 +
 
 +
===Header===
 +
 
 +
A header minimally contains information about the title of the electronic text in <titleStmt>, about its publication in <publicationStmt>, and bibliographic information about the source document from which it is derived <sourceDesc>. A minimal TEI header would look as follows:
 +
<pre>
 +
<teiHeader>
 +
<fileDesc>
 +
  <titleStmt>
 +
  <title>A title statement about the electronic text</title>
 +
  </titleStmt>
 +
  <publicationStmt>
 +
  <p>Information on the publication of the electronic text.</p>
 +
  </publicationStmt>
 +
  <sourceDesc>
 +
  <p>A bibliographic description of the source for the electronic text.</p>
 +
  </sourceDesc>
 +
</fileDesc>
 +
</teiHeader>
 +
</pre>
 +
 
 +
=== Body ===
 +
 
 +
Here is the general structure of the body content:
 +
 
 +
<pre>
 +
<text>
 +
<body>
 +
  <entryFree sortKey="AARON">
 +
  <def>The son of Amram and Jochebed, and the older brother of Moses and Miriam.</def>
 +
  </entryFree>
 +
  <entryFree sortKey="ABADDON">
 +
  <def>Destroyer, the name given to the king of the hosts represented by the locusts.</def>
 +
  </entryFree>
 +
  ....
 +
</body>
 +
</text>
 +
</pre>
 +
 
 +
1. '''sortKeys are unique and cannot be repeated.'''
 +
 
 +
2. The container for a dictionary element in TEI is <entry> for structured entries, <entryFree> for any child elements allowed, and <superEntry> to collect entries into a larger one.
 +
 
 +
* <entry> is strongly structured. It is more like a database row definition. Elements have particular parenting. And whitespace is insignificant. <entry> requires elements to be in a particular order and nested in a particular fashion and may not allow text in places one would want. <entry> seems more appropriate for original works.
 +
 
 +
* <entryFree> is weakly structured. It is more like a document. The elements can come in any order, nested in any fashion and text can be interspersed as desired. Thus, whitespace is significant. '''For transforming e-texts into TEI, <entryFree> is then highly recommended'''.
 +
 
 +
* <superEntry> can be used as a collector for several <entry> or <entryFree>. The tei2mod module creator will create an entry for the <superEntry> and one for each <entry> and <entryFree> in it.
 +
 
 +
3. The engine is designed to support multiple keys in a single dictionary module so something like <entryFree n="ἀγαπάω|agapaō|G25"> would be a feasible entry. A user could look up the same word in different languages modules without having to switch dictionaries.
 +
 
 +
An example:
 +
<pre>
 +
<entryFree n="H0002|אב">
 +
<title>H2</title>
 +
<orth>אב</orth>
 +
<orth type="trans" rend="bold">'ab</orth>
 +
<pron rend="italic">ab</pron><lb/>
 +
<def>(Chaldee); corresponding to <ref target="Strong:H0001">H1</ref>: - father.</def>
 +
</entryFree>
 +
</pre>
 +
 
 +
And here a more complicated example from our Webster1913 module
 +
<pre>
 +
<entryFree sortKey="A" split="A|A per se">
 +
<form type="headword"><orth rend="bold">A</orth></form> <pron>(<hi rend="italic">named ā in the English, and most commonly ä in other languages</hi>)</pron>. <def>The first letter of the English and of many other alphabets. The capital A of the alphabets of Middle and Western Europe, as also the small letter (a), besides the forms in Italic, black letter, etc., are all descended from the old Latin A, which was borrowed from the Greek <name type="biologicalSpecies" rend="italic"><ref target="alpha">Alpha</ref></name>, of the same form; and this was made from the first letter (�) of the Phœnician alphabet, the equivalent of the Hebrew <hi rend="italic">Aleph</hi>, and itself from the Egyptian origin. The <hi rend="italic">Aleph</hi> was a consonant letter, with a guttural breath sound that was not an element of Greek articulation; and the Greeks took it to represent their vowel <hi rend="italic">Alpha</hi> with the ä sound, the Phœnician alphabet having no vowel symbols.</def><lb/>
 +
This letter, in English, is used for several different vowel sounds. See <hi rend="italic">Guide to pronunciation</hi>, §§ 43-74. The regular long <hi rend="italic">a</hi>, as in <hi rend="italic">fate</hi>, etc., is a comparatively modern sound, and has taken the place of what, till about the early part of the 17th century, was a sound of the quality of ä (as in <hi rend="italic">far</hi>).<lb/>
 +
<sense n="2"><num type="sense">2.</num> <seg type="specialization" rend="italic">(Mus.)</seg> <def>The name of the sixth tone in the model major scale (that in C), or the first tone of the minor scale, which is named after it the scale in A minor. The second string of the violin is tuned to the A in the treble staff. — A sharp (A♯) is the name of a musical tone intermediate between A and B. — A flat (A♭) is the name of a tone intermediate between A and G.</def></sense><lb/>
 +
<re type="colloc" rend="smaller"><term type="colloc" rend="bold smaller">A per se</term> <etym>(L. <oVar rend="italic">per se</oVar> by itself)</etym>, <def rend="narrow-spacing">one preëminent; a nonesuch.</def> <usg rend="italic"></usg></re><lb/>
 +
<cit type="quotation"><quote>O fair Creseide, the flower and <oVar rend="italic">A per se</oVar><lb/>
 +
Of Troy and Greece.<lb/>
 +
<hi rend="text-align(right)"><persName type="author" rend="italic">Chaucer.</persName></hi></quote></cit><lb/>
 +
</entryFree>
 +
</pre>
 +
 
 +
==Markup==
 +
 
 +
===Linking Entries===
 +
There are three kinds of references in a dictionary:
  
 
'''Internal references''' to entries in the same dictionary.
 
'''Internal references''' to entries in the same dictionary.
  <code><xr type="see">See: <ref target="key">key text</ref></xr></code>
+
  <pre><xr type="see">See: <ref target="self:key">key text</ref></xr></pre>
 
Note: the key text may be any representation of the key. For example, the key may be G0019a and the key text may be 19a.
 
Note: the key text may be any representation of the key. For example, the key may be G0019a and the key text may be 19a.
  
 
'''External references''' to entries in another work.
 
'''External references''' to entries in another work.
  <code><xr type="xref"><ref target="work:key">key text</ref></xr></code>
+
  <pre><xr type="xref"><ref target="work:key">key text</ref></xr></pre>
Note: work is the short module name as found ''between'' square brackets as in [BDB]
+
Note: work is the short module name as found ''between'' square brackets as in [Strong]
  
 
'''Biblical references''' to scripture passages. These use osisRef and are discussed below.
 
'''Biblical references''' to scripture passages. These use osisRef and are discussed below.
  
==OSIS References==
+
====OSIS References====
  
 
For the purpose of facilitating the marking of Bible references and linking with OSIS documents, two attributes have been borrowed from OSIS:
 
For the purpose of facilitating the marking of Bible references and linking with OSIS documents, two attributes have been borrowed from OSIS:
Line 34: Line 120:
 
osisID exists on virtually all elements and contains osisID(s) (optionally with work IDs). An osisID might be used to link from an OSIS document to your TEI dictionary entry.
 
osisID exists on virtually all elements and contains osisID(s) (optionally with work IDs). An osisID might be used to link from an OSIS document to your TEI dictionary entry.
  
osisRef exists on the <code><ref></code> element. A biblical reference occurring in an entry might be marked as:
+
osisRef exists on the <tt>&lt;ref></tt> element. A biblical reference occurring in an entry might be marked as:
  <code><xr type="Bible"><ref osisRef="KJV:Gen.1.5-Gen.1.8">Genesis 1:5-8</ref></xr></code>
+
  <pre><xr type="Bible"><ref osisRef="KJV:Gen.1.5-Gen.1.8">Genesis 1:5-8</ref></xr></pre>
 +
 
 +
===Rendering Instructions===
 +
 
 +
TEI is focused on semantic markup, but supports rendering instructions on most elements via the <tt>rend</tt> attribute. This attribute contains a description (or recommendation) of how the enclosed text should be rendered. In addition, if a segment of text should be marked as primarily significant because of its differentiated rendering, it may be marked by either the <emph> or <hi> elements. <emph> indicates that the text is emphasized, whereas the more general and semantically neutral <hi> element simply acts as a place to hang the rend attribute:
 +
<code>I was <emph rend="italic">extremely</emph> excited by the new TEI filters. Yay.
 +
This text is <hi rend="bold">bold</hi></code>
 +
The <tt>rend</tt> attribute may contain a list of values, but these values are not specified by the TEI P5 specification itself. As such, for the purpose of interoperability and consistency, it is important that values for use in Sword be enumerated. Some of these values come from the set of allowed values on the type attribute of OSIS <hi> elements, which in turn borrows from CSS. Other values will generally borrow from CSS conventions.
 +
 
 +
CrossWire values for the TEI P5 <tt>rend</tt> attribute:
 +
bold          'from OSIS'
 +
illuminated  'from OSIS; an illuminated letter or drop-cap, rendered very large, preferably across multiple subsequent lines of text'
 +
italic        'from OSIS'
 +
line-through  'from OSIS; used for strike-through text'
 +
normal        'from OSIS; used to switch off special rendering while in the midst of a string of special rendering'
 +
small-caps    'from OSIS'
 +
sub          'from OSIS; subscript text'
 +
super        'from OSIS; superscript text'
 +
underline    'from OSIS'
 +
 
 +
===Images===
 +
 
 +
You can easily place images in your TEI file using the <graphic /> element. This element is "milestoned," meaning it isn't a container. The forward slash near the end signals that fact. Use the "url" attribute to define the location of the image relative to the compiled module. In the example below, the image "crosswire.jpg" resides in a folder "images" in the same folder as the compiled module. (SVN version)
 +
<pre>
 +
<graphic url="images/crosswire.jpg" />
 +
</pre>
 +
 
 +
===Tables===
 +
 
 +
Tables require a bit of work to get set up but can be useful for some purposes. The entire table is contained in a element, and each row is then contained in a <row> element. For each column in each row a <cell> element contains the text of that cell. The following table creates column labels in bold type and includes two columns and two rows below the label row.  (SVN version)
 +
<pre>
 +
<table>
 +
  <row>
 +
      <cell><hi type="bold">Column 1 Label</hi></cell>
 +
      <cell><hi type="bold">Column 2 Label</hi></cell>
 +
  </row>
 +
  <row>
 +
      <cell>Column 1, Row 1</cell>
 +
      <cell>Column 2, Row 1</cell>
 +
  </row>
 +
  <row>
 +
      <cell>Column 1, Row 2</cell>
 +
      <cell>Column 2, Row 2</cell>
 +
  </row>
 +
</table>
 +
</pre>
 +
 
 +
==Validation==
  
=Validation=
+
Use of the above XML header will assist in automated validation with most XML Schema Validators.
  
Use of the following XML header will assist in automated validation with most XML Schema Validators:
+
How to validate with xmllint:
 +
<nowiki>
 +
$ wget http://www.crosswire.org/OSIS/teiP5osis.2.5.0.xsd
 +
$ xmllint --noout --schema teiP5osis.2.5.0.xsd file.tei.xml</nowiki>
  
<?xml version="1.0" encoding="utf-8"?>
+
See also the TEI Validator online: https://www.teibyexample.org/exist/tools/TBEvalidator.htm
<TEI xmlns="http://www.crosswire.org/2008/TEIOSIS/namespace"
 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
      xsi:schemaLocation="http://www.crosswire.org/2008/TEIOSIS/namespace
 
        http://www.crosswire.org/osis/teiP5DictOsis.1.1.xsd">
 
  
=Importing=
+
==Importing==
The program tei2mod is used to create a Sword Lexicon/Dictionary/Daily Devotional/Glossary module from valid TEI.
+
The program tei2mod is used to create a SWORD Lexicon/Dictionary/Daily Devotional/Glossary module from valid TEI.
  
 
This is a work in progress, so please report any problems found.
 
This is a work in progress, so please report any problems found.
  
 
The current usage is:
 
The current usage is:
 +
<pre>
 +
You are running tei2mod:
 +
TEI Lexicon/Dictionary/Daily Devotional/Glossary module creation tool for
 +
The SWORD Project
 +
 +
usage: tei2mod <output/path> <teiDoc> [OPTIONS]
 +
  -z use ZIP compression (default no compression)
 +
  -Z use LZSS compression (default no compression)
 +
  -s <2|4> max text size per entry(default 4):
 +
  -c <cipher_key> encipher module using supplied key
 +
(default no enciphering)
 +
  -N Do not convert UTF-8 or normalize UTF-8 to NFC
 +
(default is to convert to UTF-8, if needed,
 +
  and then normalize to NFC. Note: all UTF-8
 +
  texts should be normalized to NFC.)
 +
 +
The options -z, -Z, and -s are mutually exclusive.
 +
</pre>
 +
 +
'''Notes:'''
 +
# At this time, enciphering does not work for tei2mod.
 +
# Currently, all compressed SWORD modules use ZIP compression.
 +
# Having keys in the proper order may noticeably improve import time and may affect the module's lookup performance of "adjacent" entries.
 +
 +
==Troubleshooting==
 +
If a module compiles but causes a front-end to crash:
 +
* Double-check the entry id (@n) to make sure there is a unique id for each entry.
 +
* For modules keyed to Strong's numbers, ensure there is "zero-padding," meaning all Strong's numbers should include four digits plus a zero at the beginning. So "G1" should be "00001". If any numbered id is not five digits, it make cause frontends to crash.
 +
* Remove all <tt>&lt;div></tt> elements.
 +
 +
== See also ==
 +
* [[Complete Lexicon Functionality]]
  
usage: ./tei2mod <output/path> <teiDoc> [OPTIONS]
+
==Other helpful sites==
  -z                    use ZIP compression (default no compression)
 
  -Z                    use LZSS compression (default no compression)
 
  -s <2|4>              max text size per entry (default 4):
 
  -c <cipher_key>        encipher module using supplied key
 
                                  (default no enciphering)
 
  -N                    Do not convert UTF-8 or normalize UTF-8 to NFC
 
                                  (default is to convert to UTF-8, if needed, and then normalize to NFC)
 
                                  Note: all UTF-8 texts should be normalized to NFC
 
-z, -Z, and -s are mutually exclusive
 
  
At this time, enciphering does not work.
+
[http://www.tei-c.org/release/doc/tei-p5-doc/en/html/index.html The TEI Guidelines] and in particular, the documentation for [http://www.tei-c.org/release/doc/tei-p5-doc/en/html/ref-entryFree.html <entryFree>], on which most dictionaries should be based.
  
Currently, all compressed SWORD module uses ZIP compression.
+
Tutorial modules accompanied with a dedicated examples section: https://www.teibyexample.org/exist/examples/
  
Alternatively, imp2ld can be used. But, at this time, it is not recommended, as it will not convert to NFC UTF-8.
+
==Sample TEI P5 documents==
 +
* [https://gitlab.com/crosswire-bible-society/webster1913 Webster's Dictionary (1913)]
 +
* [https://gitlab.com/crosswire-bible-society/strongsdic Strong's Dictionary]
  
Note: Having keys in the proper order may noticeably improve import time and may be affect the module's lookup performance of "adjacent" entries.
+
[[Category:Guides|TEI Dictionaries]]

Latest revision as of 15:12, 10 November 2024

Introduction

In SWORD, the "LD" module type is used to contain modules keyed to non-hierarchical keys. Such modules include: dictionaries (indexed by words or numbers), glossaries (simple one-word translation dictionaries), and daily devotionals (indexed by dates).

For lexicons and dictionaries, the use of Text Encoding Initiative P5 markup is encouraged. TEI P5 is an XML standard, quite similar to OSIS and ThML, intended for encoding all types of electronic documents. Since TEI is modular, it is possible to ignore the majority of its modules and use only a smaller set of tags necessary to our needs.

For the purpose using TEI P5 in SWORD, we have developed a special XML Schema that includes the basic set of P5 modules necessary for dictionaries and adds osisID and osisRef attributes (with their normal OSIS syntax) to many elements. This will permit cross-referencing with OSIS modules and the use of standard Bible references in TEI documents. Our customized TEI schema is available at http://www.crosswire.org/OSIS/teiP5osis.2.5.0.xsd.

Order

SWORD uses a strict binary search to find entries and nearest entries in a "LD" module. There are two restrictions that this places upon a TEI dictionary:

1) Keys are unique and cannot be repeated. This poses problems with some dictionaries that have more than 1 entry for a key. These will need to be merged.

2) Entries will be re-ordered (by the importer utility) based upon their UTF-8 code points. Fortunately this turns out to be identical to a simple 8-bit ASCII collation.

Note: Some characters can be composed or decomposed. The tei2mod importer will normalize to NFC using ICU. Any program that does not normalize its search request in exactly the same way cannot be expected to find entries.

General Structure

To produce a Lexicon/Dictionary with our customized TEI Schema, you can use this template:

<?xml version="1.0" encoding="utf-8"?>
 <TEI xmlns="http://www.crosswire.org/2013/TEIOSIS/namespace"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.crosswire.org/2013/TEIOSIS/namespace
                          http://www.crosswire.org/OSIS/teiP5osis.2.5.0.xsd">

Header

A header minimally contains information about the title of the electronic text in <titleStmt>, about its publication in <publicationStmt>, and bibliographic information about the source document from which it is derived <sourceDesc>. A minimal TEI header would look as follows:

<teiHeader>
 <fileDesc>
  <titleStmt>
   <title>A title statement about the electronic text</title>
  </titleStmt>
  <publicationStmt>
   <p>Information on the publication of the electronic text.</p>
  </publicationStmt>
  <sourceDesc>
   <p>A bibliographic description of the source for the electronic text.</p>
  </sourceDesc>
 </fileDesc>
</teiHeader>

Body

Here is the general structure of the body content:

<text>
 <body>
  <entryFree sortKey="AARON">
   <def>The son of Amram and Jochebed, and the older brother of Moses and Miriam.</def>
  </entryFree>
  <entryFree sortKey="ABADDON">
   <def>Destroyer, the name given to the king of the hosts represented by the locusts.</def>
  </entryFree>
  ....
 </body>
</text>

1. sortKeys are unique and cannot be repeated.

2. The container for a dictionary element in TEI is <entry> for structured entries, <entryFree> for any child elements allowed, and <superEntry> to collect entries into a larger one.

  • <entry> is strongly structured. It is more like a database row definition. Elements have particular parenting. And whitespace is insignificant. <entry> requires elements to be in a particular order and nested in a particular fashion and may not allow text in places one would want. <entry> seems more appropriate for original works.
  • <entryFree> is weakly structured. It is more like a document. The elements can come in any order, nested in any fashion and text can be interspersed as desired. Thus, whitespace is significant. For transforming e-texts into TEI, <entryFree> is then highly recommended.
  • <superEntry> can be used as a collector for several <entry> or <entryFree>. The tei2mod module creator will create an entry for the <superEntry> and one for each <entry> and <entryFree> in it.

3. The engine is designed to support multiple keys in a single dictionary module so something like <entryFree n="ἀγαπάω|agapaō|G25"> would be a feasible entry. A user could look up the same word in different languages modules without having to switch dictionaries.

An example:

<entryFree n="H0002|אב">
 <title>H2</title>
 <orth>אב</orth>
 <orth type="trans" rend="bold">'ab</orth>
 <pron rend="italic">ab</pron><lb/>
 <def>(Chaldee); corresponding to <ref target="Strong:H0001">H1</ref>: - father.</def>
</entryFree>

And here a more complicated example from our Webster1913 module

<entryFree sortKey="A" split="A|A per se">
<form type="headword"><orth rend="bold">A</orth></form> <pron>(<hi rend="italic">named ā in the English, and most commonly ä in other languages</hi>)</pron>. <def>The first letter of the English and of many other alphabets. The capital A of the alphabets of Middle and Western Europe, as also the small letter (a), besides the forms in Italic, black letter, etc., are all descended from the old Latin A, which was borrowed from the Greek <name type="biologicalSpecies" rend="italic"><ref target="alpha">Alpha</ref></name>, of the same form; and this was made from the first letter (�) of the Phœnician alphabet, the equivalent of the Hebrew <hi rend="italic">Aleph</hi>, and itself from the Egyptian origin. The <hi rend="italic">Aleph</hi> was a consonant letter, with a guttural breath sound that was not an element of Greek articulation; and the Greeks took it to represent their vowel <hi rend="italic">Alpha</hi> with the ä sound, the Phœnician alphabet having no vowel symbols.</def><lb/>
This letter, in English, is used for several different vowel sounds. See <hi rend="italic">Guide to pronunciation</hi>, §§ 43-74. The regular long <hi rend="italic">a</hi>, as in <hi rend="italic">fate</hi>, etc., is a comparatively modern sound, and has taken the place of what, till about the early part of the 17th century, was a sound of the quality of ä (as in <hi rend="italic">far</hi>).<lb/>
<sense n="2"><num type="sense">2.</num> <seg type="specialization" rend="italic">(Mus.)</seg> <def>The name of the sixth tone in the model major scale (that in C), or the first tone of the minor scale, which is named after it the scale in A minor. The second string of the violin is tuned to the A in the treble staff. — A sharp (A♯) is the name of a musical tone intermediate between A and B. — A flat (A♭) is the name of a tone intermediate between A and G.</def></sense><lb/>
<re type="colloc" rend="smaller"><term type="colloc" rend="bold smaller">A per se</term> <etym>(L. <oVar rend="italic">per se</oVar> by itself)</etym>, <def rend="narrow-spacing">one preëminent; a nonesuch.</def> <usg rend="italic"></usg></re><lb/>
<cit type="quotation"><quote>O fair Creseide, the flower and <oVar rend="italic">A per se</oVar><lb/>
Of Troy and Greece.<lb/>
<hi rend="text-align(right)"><persName type="author" rend="italic">Chaucer.</persName></hi></quote></cit><lb/>
</entryFree>

Markup

Linking Entries

There are three kinds of references in a dictionary:

Internal references to entries in the same dictionary.

<xr type="see">See: <ref target="self:key">key text</ref></xr>

Note: the key text may be any representation of the key. For example, the key may be G0019a and the key text may be 19a.

External references to entries in another work.

<xr type="xref"><ref target="work:key">key text</ref></xr>

Note: work is the short module name as found between square brackets as in [Strong]

Biblical references to scripture passages. These use osisRef and are discussed below.

OSIS References

For the purpose of facilitating the marking of Bible references and linking with OSIS documents, two attributes have been borrowed from OSIS:

osisID exists on virtually all elements and contains osisID(s) (optionally with work IDs). An osisID might be used to link from an OSIS document to your TEI dictionary entry.

osisRef exists on the <ref> element. A biblical reference occurring in an entry might be marked as:

<xr type="Bible"><ref osisRef="KJV:Gen.1.5-Gen.1.8">Genesis 1:5-8</ref></xr>

Rendering Instructions

TEI is focused on semantic markup, but supports rendering instructions on most elements via the rend attribute. This attribute contains a description (or recommendation) of how the enclosed text should be rendered. In addition, if a segment of text should be marked as primarily significant because of its differentiated rendering, it may be marked by either the <emph> or <hi> elements. <emph> indicates that the text is emphasized, whereas the more general and semantically neutral <hi> element simply acts as a place to hang the rend attribute:

I was <emph rend="italic">extremely</emph> excited by the new TEI filters. Yay.
This text is <hi rend="bold">bold</hi>

The rend attribute may contain a list of values, but these values are not specified by the TEI P5 specification itself. As such, for the purpose of interoperability and consistency, it is important that values for use in Sword be enumerated. Some of these values come from the set of allowed values on the type attribute of OSIS <hi> elements, which in turn borrows from CSS. Other values will generally borrow from CSS conventions.

CrossWire values for the TEI P5 rend attribute:

bold          'from OSIS'
illuminated   'from OSIS; an illuminated letter or drop-cap, rendered very large, preferably across multiple subsequent lines of text'
italic        'from OSIS'
line-through  'from OSIS; used for strike-through text'
normal        'from OSIS; used to switch off special rendering while in the midst of a string of special rendering'
small-caps    'from OSIS'
sub           'from OSIS; subscript text'
super         'from OSIS; superscript text'
underline     'from OSIS'

Images

You can easily place images in your TEI file using the <graphic /> element. This element is "milestoned," meaning it isn't a container. The forward slash near the end signals that fact. Use the "url" attribute to define the location of the image relative to the compiled module. In the example below, the image "crosswire.jpg" resides in a folder "images" in the same folder as the compiled module. (SVN version)

<graphic url="images/crosswire.jpg" />

Tables

Tables require a bit of work to get set up but can be useful for some purposes. The entire table is contained in a element, and each row is then contained in a <row> element. For each column in each row a <cell> element contains the text of that cell. The following table creates column labels in bold type and includes two columns and two rows below the label row. (SVN version)

<table>
   <row>
      <cell><hi type="bold">Column 1 Label</hi></cell>
      <cell><hi type="bold">Column 2 Label</hi></cell>
   </row>
   <row>
      <cell>Column 1, Row 1</cell>
      <cell>Column 2, Row 1</cell>
   </row>
   <row>
      <cell>Column 1, Row 2</cell>
      <cell>Column 2, Row 2</cell>
   </row>
</table>

Validation

Use of the above XML header will assist in automated validation with most XML Schema Validators.

How to validate with xmllint:

$ wget http://www.crosswire.org/OSIS/teiP5osis.2.5.0.xsd
$ xmllint --noout --schema teiP5osis.2.5.0.xsd file.tei.xml

See also the TEI Validator online: https://www.teibyexample.org/exist/tools/TBEvalidator.htm

Importing

The program tei2mod is used to create a SWORD Lexicon/Dictionary/Daily Devotional/Glossary module from valid TEI.

This is a work in progress, so please report any problems found.

The current usage is:

You are running tei2mod:
TEI Lexicon/Dictionary/Daily Devotional/Glossary module creation tool for
	The SWORD Project

usage: tei2mod <output/path> <teiDoc> [OPTIONS]
  -z			 use ZIP compression (default no compression)
  -Z			 use LZSS compression (default no compression)
  -s <2|4>		 max text size per entry(default 4):
  -c <cipher_key>	 encipher module using supplied key
				 (default no enciphering)
  -N			 Do not convert UTF-8 or normalize UTF-8 to NFC
				 (default is to convert to UTF-8, if needed,
				  and then normalize to NFC. Note: all UTF-8
				  texts should be normalized to NFC.)

	The options -z, -Z, and -s are mutually exclusive.

Notes:

  1. At this time, enciphering does not work for tei2mod.
  2. Currently, all compressed SWORD modules use ZIP compression.
  3. Having keys in the proper order may noticeably improve import time and may affect the module's lookup performance of "adjacent" entries.

Troubleshooting

If a module compiles but causes a front-end to crash:

  • Double-check the entry id (@n) to make sure there is a unique id for each entry.
  • For modules keyed to Strong's numbers, ensure there is "zero-padding," meaning all Strong's numbers should include four digits plus a zero at the beginning. So "G1" should be "00001". If any numbered id is not five digits, it make cause frontends to crash.
  • Remove all <div> elements.

See also

Other helpful sites

The TEI Guidelines and in particular, the documentation for <entryFree>, on which most dictionaries should be based.

Tutorial modules accompanied with a dedicated examples section: https://www.teibyexample.org/exist/examples/

Sample TEI P5 documents