Generated Grammatical Diagrams

From Psalms: Layer by Layer
Jump to: navigation, search

User Guide for Generated Diagrams

SentenceDiagrammer Overview

The outermost XML element is GrammaticalDiagram. It represents the whole diagram.

Note: The XML names are not case sensitive.

The Configuration element is used to specify options about drawing the diagram.

The Elements used to draw elements are:

  • Fragment: Used to start a new baseline.
  • Straight: Used to draw text on a baseline.
  • Down: Used to draw a vertical line from a Straight. (construct chains)
  • SlantDown: Used to draw descenders from a Straight. (prepositional phrases & adv. accusatives)
  • Marker: Used to draw a line that intersects the baseline. (btw subject & predicate, or with style=up for a direct object)
  • Group: Used to draw a set of parallel constructions.
  • Conjunction: Used in a Group between the parallel branches.
  • Pedestal: Used to start a new baseline above the current baseline. (for clauses used as a constituent)
  • Segment: Used to provide a collection of elements where one element is expected, such as for Pedestal or Group.
  • Target: A child of a Segment that specifies where in the segment the line from a Pedestal should connect.

Elements used for annotating a diagram are:

  • Ellipse: Used to highlight a portion of the diagram.
  • Text: Used to add comments, notes, titles, etc., to the diagram.

GrammaticalDiagram

The GrammaticalDiagram can have the following child elements in any order:

  • Zero or one Configuration elements
  • Zero or more Fragment elements
  • Zero or more Straight elements
  • Zero or more Marker elements
  • Zero or more Group elements

Configuration

The Configuration element can have child elements which specify what elements are being configured. They are:

Diagram

Options that affect the whole diagram.

  • Direction: Specifies if the diagram is drawn left-to-right (LTR) or right-to-left (RTL). The default is LTR.
  • SlantAngle: Specifies the angle of slanted lines used in SlantDown and Group in degrees from the horizontal specified as an integer. The default is 60.
  • ShowOutlines: Used for debugging the drawing algorithms. Will show an outline around each element in the diagram. Can be True or False. The default is False.

Line

Options that specify how to draw the lines in the diagram. The defined attributes for the Line element are:

  • Color: Specify the color name to be used for drawing lines.
  • Width: The width of the line. Specified as an integer.

Word

Options that specify how to format the Word text. The defined attributes for the Word element are:

  • Color: Specify the color name to be used for Word text.
  • ImpliedColor: The color name to use when the Style is Implied.
  • Family: The font family to use for this text.
  • Size: The font size to use for this text. The default is 12 point.
  • Weight: How light or bold to make this text.
Not all fonts distinguish between all the legal weight values. The defined values are:
    • Normal
    • Bold
    • 100 is the lightest
    • 200
    • 300
    • 400 is Normal
    • 500
    • 600
    • 700 is Bold
    • 800
    • 900 is the heaviest

Gloss

Options that specify how to format the Gloss text. The defined attributes for this element are the same as for the Word text.

An example configuration is:

<configuration>
   <diagram direction="rtl" slantangle="60"/>
   <line color="Black" width="1"/>
   <word color="Red" family="arial" weight="normal"/>
   <gloss color="Green" family="sans-serif" weight="Bold"/>
</configuration>

Fragment

You can put multiple fragments in a diagram. Fragment is also used to put elements on a line by themselves. Fragment is optional if you only have one. If you use Fragment, then all the other elements in the diagram must be children of it. A Fragment can only be a child of GrammaticalDiagram.

The Fragment has the following attributes which can be used to add extra space around the diagram when the sizing algorithm isn't quite right or to make room for Text to display.

  • SpaceBefore
  • SpaceAfter
  • SpaceAbove
  • SpaceBelow

The allowed child elements are:

  • Straight
  • Marker
  • Group
  • Pedestal
  • Ellipse
  • Text

Common Examples

  • subj-verb-d.o.-subj complem.

PdfImage-ex.1.png

   <straight gloss="gloss" word="subj.word"/>
   <marker/>
   <straight gloss="gloss" word="verb word"/>
   <marker style="up"/>
   <straight gloss="gloss" word="d.o. word"/>
   <marker style="up reverse"/>
   <straight gloss="gloss" word="complement"/>
  • implied subject-branching verb phrases

PdfImage-ex.2.png

   <straight style="implied" word="()"/>
   <marker/>
   <group>
       <segment>
           <straight gloss="gloss" word=" word"/>
       </segment>
       <conjunction style="dash" gloss="gloss" word="conj. word"/> 
       <segment>
           <straight gloss="gloss" word=" word"/>
           <marker/>
           <group style="triangle" closed="false">
               <segment>
                   <straight gloss="gloss" word=" word"/>
               </segment>
               <conjunction style="dash" gloss="gloss" word=" word"/> 
               <segment>
                   <straight gloss="gloss" word=" word"/>
               </segment>
               <conjunction style="dash" gloss="gloss" word=" word"/> 
               <segment>
                   <straight gloss="gloss" word=" word"/>
               </segment>
           </group>
       </segment>
   </group>
  • conjunctions and constructs

PdfImage-ex.3.png

   <straight gloss="gloss" word="subj.word"/>
   <marker/>
   <straight gloss="gloss" word="verb word">
       <slantdown gloss="gloss" word="prep. word">
           <straight gloss="gloss" word="word"/>
       </slantdown>
   </straight>
   <marker style="up"/>
   <straight gloss="gloss" word="d.o. word">
       <down>
           <straight gloss="gloss" word="construct"/>
       </down>
   </straight>
   <marker style="up reverse"/>
   <straight gloss="gloss" word="complement">
       <down style="dashed">
           <straight style="dashed" gloss="gloss" word="conjunction">
               <down style="dashed">
                   <straight gloss="gloss" word="word"/>
               </down>
           </straight>
       </down>
   </straight>
  • prepositional phrases

PdfImage-ex.4.png

   <straight gloss="gloss" word="subj.word"/>
   <marker/>
   <straight gloss="gloss" word="verb word"/>
   <marker style="up reverse"/>
   <straight/>
   <pedestal>
       <segment>
           <straight gloss="gloss" word="word"/>
           <marker/>
           <target/>
           <straight gloss="gloss" word="word">
               <down style="atend">
                   <straight gloss="gloss" word="word"/>
               </down>
           </straight>
        </segment>
   </pedestal>
  • participles

PdfImage-ex.5.png

   <straight gloss="gloss" word="subj.word"/>
   <marker/>
   <straight gloss="gloss" word="verb word"/>
   <marker style="up"/>
   <straight gloss="gloss" word="d.o. word">
       <down>
           <straight style="round" gloss="gloss" word="participle"/>
       </down>
   </straight>
   <marker style="up reverse"/>
   <straight gloss="gloss" word="complement"/>
  • infinitives
  • appositions


Problems

  • hexadecimal numbers for colors (how can I put in hex no. in the configuration?)
  • apposition or fragments detached from main diagram
  • infinitives (right now using two marker lines)

PdfImage-Ps.26.7-infinitives.png

   <pedestal>
       <segment>
           <target/>
           <straight/>
           <marker/>
           <marker/>
           <straight gloss="proclaim" word="שְׁמִעַ">
               <slantdown  gloss="with" word="בְּ">
                   <straight gloss="voice" word="ק֣וֹל">
                       <down>
                           <straight gloss="thanksgiving" word="תּוֹדָ֑ה"/>
                       </down>
                   </straight>
               </slantdown>
           </straight>
       </segment>
   </pedestal>
  • extra dashed lines when dashed conjunction line is placed between segments in a group

PdfImage-Ps.26.7-extradash.png

<group>   
 <segment>
   <pedestal>
       <segment>
           <target/>
           <straight/>
           <marker/>
           <marker/>
           <straight gloss="proclaim" word="שְׁמִעַ">
               <slantdown  gloss="with" word="בְּ">
                   <straight gloss="voice" word="ק֣וֹל">
                       <down>
                           <straight gloss="thanksgiving" word="תּוֹדָ֑ה"/>
                       </down>
                   </straight>
               </slantdown>
           </straight>
       </segment>
   </pedestal>
  </segment>
 <conjunction style="dash" gloss="and" word="וְ"/>
 <segment>
   <pedestal>
       <segment>
           <target/>
           <straight/>
           <marker/>
           <marker/>
           <straight gloss="proclaim" word="שְׁמִעַ">
               <slantdown  gloss="with" word="בְּ">
                   <straight gloss="voice" word="ק֣וֹל">
                       <down>
                           <straight gloss="thanksgiving" word="תּוֹדָ֑ה"/>
                       </down>
                   </straight>
               </slantdown>
           </straight>
       </segment>
   </pedestal>
  </segment>
</group>
  • conjunction and preposition lines should come down from marker lines

Movinglinetomarker.png

   <straight style="implied" word="()">
   <down style="dash atend">
       <straight style="dash" gloss="and" word="כִּֽיּ">
           <down style="dash">
               <straight gloss="I" word="אֲ֖נִי"/>
           </down>
       </straight>
   </down>
   </straight>
   <marker/>
   <straight gloss="judge" word="שָׁפְטֵ֬"/>


  • Sometimes diagrams need to start with a slantdown or a down (right now it just won't let it so I have to use a straight first). The straight is acceptable for a superscription but now when a prepositional phrase is on a pedestal.

PdfImage-Ps.26.1.1.png

   <straight>
       <slantdown gloss="of" word="לְ">
           <straight gloss="David" word="דָוִ֨ד"/>
       </slantdown>
   </straight>
  • when straight style:round lines have a child (ex. down or slantdown)

PdfImage-probwithround.png

   <straight gloss="all" word="כָּל">
       <down>
           <straight style="round" gloss="wondrous works" word="נִפְלְאוֹתֶֽיךָ">
               <slantdown>
                   <straight gloss="you" word="ךָ"/>
               </slantdown>
           </straight>
       </down>
   </straight>
  • Having a slantdown not attached to a straigt (would also be a problem for a down

Probolemstartinigwithslantdown.png

  • Starting with a group and attaching on the left side not the right. This would also mean having the conjunction joining the two segments right at the beginning of the line (far right).


Starrting with a group.jpeg

  • Some groups are also attached on both ends

Doubleendconnectedgroup.jpeg


Grouped adverbs

We need to be able to group multiple adverbs together Grouped adverbs with conjunction.jpg

Grouped prepositional phrases

We need to be able to group multiple prepositional phrases together. Grouped prepositional phrases.jpg

Pedestals on non-base-lines

As far as I can tell, pedestals can only go on full baselines. Pedestal within prep phrase.jpg