---
 # Note to translators:
 #   most languages don't have two ways to pronounce 'a' -- if not need, remove the rules and change "B-Z" to "A-Z"
 #   some languages say the word for "uppercase" after the letter. Make sure to change that where appropriate by moving some code around
 - "a": 
    - test: 
        if: "$TTS='none'"
        then: [t: "eigh"]                         # long "a" sound in all speech engines I tested (espeak, MS SAPI, eloquence,
        else: [spell: "'a'"]                         #    AWS Polly, ReadSpeaker, NaturalReader, google cloud, nuance, ibm watson)
 - "b-z": 
    - test: 
        if: "$TTS='none'"
        then: [t: "."]                          
        else: [spell: "'.'"]                       

 # Capital letters are a little tricky: users can pick their favorite word (something that was requested) and 
 # screen readers have options to use pitch changes or beeps instead of or in addition to say "cap"
 # Also, if a user can see the screen, they probably don't need to hear "cap", but if they specified an override, they must want to hear the override.

 - "A":
    - test: 
        if: "$CapitalLetters_Beep"
        then:
        - audio:
            value: "beep.mp4"
            replace: []
    - test: 
        if: "$CapitalLetters_UseWord"
        then_test:
          if: "$SpeechOverrides_CapitalLetters = ''"
          then_test:
            if: "$Impairment = 'Blindness'"
            then: [t: "cap"]
          else: [x: "$SpeechOverrides_CapitalLetters"]
    - pitch:
        value: "$CapitalLetters_Pitch"
        replace:
        - test:
            if: "$TTS='none'"
            then: [t: "eigh"]
            else: [spell: "'a'"]
            
 - "B-Z":
    - test: 
        if: "$CapitalLetters_Beep"
        then:
        - audio:
            value: "beep.mp4"
            replace: []
    - test: 
        if: "$CapitalLetters_UseWord"
        then_test:
          if: "$SpeechOverrides_CapitalLetters = ''"
          then_test:
            if: "$Impairment = 'Blindness'"
            then: [t: "cap"]
          else: [x: "$SpeechOverrides_CapitalLetters"] 
    - pitch:
        value: "$CapitalLetters_Pitch"
        # note: processing of ranges converts '.' into the character, so it needs to be in quotes below
        replace: [spell: "translate('.', 'BCDEFGHIJKLMNOPQRSTUVWXYZ', 'bcdefghijklmnopqrstuvwxyz')"]

 - "0-9": [t: "."]

 - " ": [t: " "]                     # 0x20

 - "!":                                            # 0x21
    - test:
        if: "ancestor-or-self::*[contains(@data-intent-property, ':literal:')]"
        then_test:
            if: "$Verbosity = 'Terse'"
            then: [t: "bang"]                      # 0x21
            else: [t: "exclamation point"]          # 0x21
        else: [t: "factorial"]                     # 0x21
          
 - "\"": [t: "quotation mark"]                     # 0x22
 - "#": [t: "number"]                              # 0x23
 - "$": [t: "dollars"]                             # 0x24
 - "%": [t: "percent"]                             # 0x25
 - "&": [t: "ampersand"]                           # 0x26
 - "'": [t: "apostrophe"]                          # 0x27
 - "(":                                            # 0x28
    - test:
        if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak'
        then_test:
            if: "$Verbosity='Terse'"
            then: [t: "open"]                     # 0x28
            else: [t: "open paren"]               # 0x28
        else: [t: "left paren"]                   # 0x28                         
 - ")":                                          # 0x29
    - test:
        if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak'
        then_test:
            if: "$Verbosity='Terse'"
            then: [t: "close"]                   # 0x29
            else: [t: "close paren"]             # 0x29
        else: [t: "right paren"]                 # 0x29                 

 - "*":                                          # 0x2a
    test:
        if: "parent::*[name(.)='msup' or name(.)='msubsup' or name(.)='skip-super']"
        then: [t: "star"]                        # 0x2a
        else: [t: "times"]                       # 0x2a
 - "+": [t: "plus"]                              # 0x2b
 - ",":                                          # 0x2c
    # the following deals with the interaction of "," with "…" which sometimes wants the ',' to be silent
    # that this test is here and not with "…" is not ideal, but seems simplest
     test:
        if:
            - "$SpeechStyle != 'ClearSpeak' or $ClearSpeak_Ellipses = 'Auto' or "
               # must be ClearSpeak and $ClearSpeak_Ellipses = 'AndSoOn'
               # speak "comma" when not adjacent to '…'
            - "( following-sibling::*[1][text()!= '…'] and preceding-sibling::*[1][text()!='…']  ) or "
               # except if expression starts with '…'
            - "../*[1][.='…'] "
        then:
        - T: "comma"                         # 	(en: 'comma', google translation)
        - test:
            if: "$Verbosity != Terse"
            then: [pause: short]
        # else silent

 - "-": [t: "minus"]                               # 0x2d
 - ".":                                          # 0x2e
    - test:
        if: "parent::*[1][self::m:mn]"
        then: [t: "point"]
        else: [t: "dot"]
 - "/":                                           # 0x2f
    - test:
        if: "ancestor-or-self::*[contains(@data-intent-property, ':literal:')]"
        then: [t: "slash"]                        # 0x2f
        else: [t: "divided by"]                   # 0x2f

 - ":": [t: "colon"]                               # 0x3a
 - ";": [t: "semicolon"]                           # 0x3b
 - "<":                                          # 0x3c
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "less than"
 - "=":                                           # 0x3d
    - test: 
        if: "$Verbosity!='Terse'"
        then: [t: "is equal to"]
        else: [t: "equals"]

 - ">":                                          # 0x3e
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "greater than"
 - "?": [t: "question mark"]                       # 0x3f
 - "@": [t: "at sign"]                             # 0x40
 - "[":                                          # 0x5b
    - test:
        if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak'
        then: [t: "open bracket"]
        else: [t: "left bracket"]                            
 - "\\": [t: "back slash"]                         # 0x5c
 - "]":                                          # 0x5d
    - test:
        if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak'
        then: [t: "close bracket"]
        else: [t: "right bracket"]
 - "^":                                           # 0x5e
    - test:
        if: "parent::m:modified-variable or parent::m:mover"
        then: [t: "hat"]
        else: [t: "caret"]
 - "_": [t: "under bar"]                          # 0x5f
 - "`": [t: "grave"]                              # 0x60
 - "{":                                         # 0x7b
    - test:
        if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak'
        then: [t: "open brace"]
        else: [t: "left brace"]                            
 - "|":                                          # 0x7c
    # note: for ClearSpeak and SimpleSpeak, "|" inside of sets is handled at the mrow level, same for 'sets'
     - with:
        variables: [DefaultToGiven: "count(preceding-sibling::*)=1 and count(following-sibling::*)=1 and ../../../*[1][.='P']"] # P(A|B)
        replace:
        - test:
            - if: "ancestor-or-self::*[contains(@data-intent-property, ':literal:')]"
              then: [t: "vertical line"]
            - else_if: "$SpeechStyle != 'ClearSpeak'"
              then_test:
                - if: "$DefaultToGiven"
                  then: [t: "given"]
                - else_if: "preceding-sibling::*[1][self::m:mn and not(contains(., $DecimalSeparators))] and 
                            following-sibling::*[1][self::m:mn and not(contains(., $DecimalSeparators))]"
                  then: [t: "divides"]
                  else: [t: "vertical line"]
            - else_if: "not(preceding-sibling::*) or not(following-sibling::*)"
              then: [t: "vertical line"]
            - else_if: "$ClearSpeak_VerticalLine = 'SuchThat'"
              then: [t: "such that"]
            - else_if: "$ClearSpeak_VerticalLine = 'Given' or $DefaultToGiven"
              then: [t: "given"] 
            - else: [t: "divides"]                   

 - "}":                                          # 0x7d
    - test:
        if: $SpeechStyle = 'ClearSpeak' or $SpeechStyle = 'SimpleSpeak'
        then: [t: "close brace"]
        else: [t: "right brace"]                            

 - "~": [t: "tilde"]                               # 0x7e
 - " ":                                            # 0xa0
    - test:
        # could be mtext in mtd or mtext in an mrow that is a concatenation of mtd's. Is there a better solution?
        if: "@data-empty-in-2D and not(ancestor::*[self::m:piecewise or self::m:system-of-equations or self::m:lines])"
        then: [t: "empty"]                         # want to say something for fraction (etc) with empty child
        else: [t: ""]                            

 - "¬": [t: "not"]                                 # 0xac
 - "°": [t: "degrees"]                           # 0xb0
 - "±": [t: "plus or minus"]                       # 0xb1
 - "´": [t: "acute"]                            # 0xb4
 - "·":                                            # 0xB7
    - test:
        if: "ancestor-or-self::*[contains(@data-intent-property, ':literal:')] or not($SpeechStyle = 'ClearSpeak' and $ClearSpeak_MultSymbolDot = 'Auto')"
        then: [t: "dot"]
        else: [t: "times"]
 - "×":                                          # 0xd7
    - test:
        if: "$SpeechStyle = 'ClearSpeak'"
        then_test:
        - if: "$ClearSpeak_MultSymbolX = 'Auto'"
          then: [t: "times"]
        - else_if: "$ClearSpeak_MultSymbolX = 'By'"
          then: [t: "by"]
          else: [t: "cross"]
        else_test:
            if: "ancestor-or-self::*[contains(@data-intent-property, ':literal:')]"
            then: [t: "cross"]
            else: [t: "times"]

 - "÷": [t: "divided by"]                          # 0xf7
 - "̀": [t: "grave accent embellishment"]          # 0x300
 - "́": [t: "acute accent embellishment"]          # 0x301
 - "̂": [t: "circumflex accent embellishment"]     # 0x302
 - "̃": [t: "tilde embellishment"]                 # 0x303
 - "̄": [t: "macron embellishment"]                # 0x304
 - "̅": [t: "overbar embellishment"]               # 0x305
 - "̆": [t: "breve"]                               # 0x306
 - "̇": [t: "dot above embellishment"]             # 0x307

   # Note: ClearSpeak has pref TriangleSymbol for "Δ", but that is wrong
 - "Α-Ω": 
    - test: 
        if: "$CapitalLetters_Beep"
        then:
        - audio:
            value: "beep.mp4"
            replace: []
    - test: 
        if: "$CapitalLetters_UseWord"
        then_test:
          if: "$SpeechOverrides_CapitalLetters = ''"
          then_test:
            if: "$Impairment = 'Blindness'"
            then: [t: "cap"]
          else: [x: "$SpeechOverrides_CapitalLetters"] 
    - pitch:
        value: "$CapitalLetters_Pitch"
        # note: processing of ranges converts '.' into the character, so it needs to be in quotes below
        replace: [spell: "translate('.', 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ΢ΣΤΥΦΧΨΩ', 'αβγδεζηθικλμνξοπρςστυφχψω')"]

 - "α": [t: "alpha"]                               # 0x3b1
 - "β": [t: "beta"]                                # 0x3b2
 - "γ": [t: "gamma"]                               # 0x3b3
 - "δ": [t: "delta"]                               # 0x3b4
 - "ε": [t: "epsilon"]                             # 0x3b5
 - "ζ": [t: "zeta"]                                # 0x3b6
 - "η": [t: "eta"]                                 # 0x3b7
 - "θ": [t: "theta"]                               # 0x3b8
 - "ι": [t: "iota"]                                # 0x3b9
 - "κ": [t: "kappa"]                               # 0x3ba
 - "λ": [t: "lambda"]                               # 0x3bb
 - "μ": [t: "mu"]                                  # 0x3bc
 - "ν": [t: "nu"]                                  # 0x3bd
 - "ξ": [t: "zai"]                                 # 0x3be
 - "ο": [t: "omicron"]                             # 0x3bf
 - "π": [t: "pi"]                                  # 0x3c0
 - "ρ": [t: "rho"]                                 # 0x3c1
 - "ς": [t: "final sigma"]                         # 0x3c2
 - "σ": [t: "sigma"]                               # 0x3c3
 - "τ": [t: "tau"]                                 # 0x3c4
 - "υ": [t: "upsilon"]                             # 0x3c5
 - "φ": [t: "phi"]                                 # 0x3c6
 - "χ": [t: "chi"]                                 # 0x3c7
 - "ψ": [t: "psi"]                                 # 0x3c8
 - "ω": [t: "omega"]                               # 0x3c9
 - "ϕ": [t: "phi"]                                 # 0x3d5
 - "ϖ": [t: "pi"]                                  # 0x3d6
 - "ϵ": [t: "epsilon"]                             # 0x3f5
 - "϶": [t: "reversed epsilon"]                    # 0x3f6

 - "⁡":                                          # 0x2061
    - test:
        # skip saying "of" when Terse and a trig function, when it is a shape (does this happen?), or we are in :literal mode
        if: "not(
              ( $Verbosity='Terse' or ($SpeechStyle = 'ClearSpeak' and IsNode(following-sibling::*[1],'simple')) and
                preceding-sibling::*[1][IfThenElse($SpeechStyle='ClearSpeak',
                                                   IsInDefinition(., 'ClearSpeakTrigFunctionNames'),
                                                   IsInDefinition(., 'TrigFunctionNames') )]
              ) or
              preceding-sibling::*[1][IsInDefinition(., 'GeometryShapes')] or
              (@data-changed='added' and ancestor-or-self::*[contains(@data-intent-property, ':literal:')])
            )"
        then: [t: "of"]
 - "⁢": [t: ""]                                   # 0x2062
 - "⁣": [t: ""]                                   # 0x2063
 - "⁤": [t: "and"]                                # 0x2064
 - "ℂℕℚℝℤ":     # here we rely on this running through the table again to speak "cap xxx"
    - t: "double-struck"
    - spell: "translate('.', 'ℂℕℚℝℤ', 'CNQRZ')"

 - "℃": [t: "degrees celsius"]                     # 0x2103
 - "ℋℛℓ":                                          # 0x210b
    - t: "script"
    - spell: "translate('.', 'ℋℛℓ', 'HRl')"
 - "ℜ":                                          # 0x211c
    - t: "fraktur"
    - spell: "'R'"

 - "ⅆⅇⅈⅉ":                                          # 0x2146-9
    - t: "double-struck italic"
    - spell: "translate('.', 'ⅆⅇⅈⅉ', 'deij')"

 - "←": [t: "left arrow"]                     # 0x2190
 - "↑": [t: "up arrow"]                       # 0x2191
 - "→":                                          # 0x2192
     - test:
        if: "ancestor::*[2][self::m:limit]"
        then: [t: "approaches"]
        else: [t: "right arrow"]

 - "↓": [t: "down arrow"]                     # 0x2193
 - "∈":                                          # 0x2208
     - test:
        if: "$SpeechStyle != 'ClearSpeak'"
        then:
        - test:
            if: "$Verbosity!='Terse' and not(ancestor::*[self::m:set])"    # "the set x is an element of ..." sounds bad"
            then: [t: "is"]
        - t: "an element of"
        # Several options for speaking elements in ClearSpeak -- they split between being inside a set or not and then the option
        else_test:
            if: "../../self::m:set or ../../../self::m:set" # inside a set
            then_test:
              - if: $ClearSpeak_SetMemberSymbol = 'Auto' or $ClearSpeak_SetMemberSymbol = 'In'
                then: [t: "in"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Member'
                then: [t: "member of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Element'
                then: [t: "element of"]
              - else: [t: "belonging to"]             # $ClearSpeak_SetMemberSymbol = 'Belongs'
            else_test:
              - if: $ClearSpeak_SetMemberSymbol = 'Auto' or $ClearSpeak_SetMemberSymbol = 'Member'
                then: [t: "is a member of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Element'
                then: [t: "is an element of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'In'
                then: [t: "is in"]
              - else: [t: "belongs to"]              # $ClearSpeak_SetMemberSymbol = 'Belongs'
 - "∥":                                           # 0x2225
     - test:
         if: "ancestor-or-self::*[contains(@data-intent-property, ':literal:')]"
         then: [t: "double vertical line"]
         else:
         - test:
              if: "$Verbosity!='Terse'"
              then: [t: "is"]
         - t: "parallel to"
 - "∦":                                           # 0x2226
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "not parallel to"
 - "≤":                                          # 0x2264
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "less than or equal to"
 - "≥":                                          # 0x2265
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "greater than or equal to"

 # --- restored complex short definitions (prefer over unicode-full) ---
 - "…":                                          # 0x2026
    test:
        if:
            - "$SpeechStyle != 'ClearSpeak' or $ClearSpeak_Ellipses = 'Auto' or"
               # must be ClearSpeak and $ClearSpeak_Ellipses = 'AndSoOn'
               # speak '…' as 'and so on...' unless expr starts with '…'
            - "../*[1][.='…']"
        then: [t: "dot dot dot"]
        else_test:  # must have $ClearSpeak_Ellipses = 'AndSoOn'
            if: "count(following-sibling::*) = 0"
            then: [t: "and so on"]
            else: [t: "and so on up to"]
 - "∂":                                          # 0x2202
     - test: 
         if: "$Verbosity='Terse'"
         then: [t: "partial"]
         else: [t: "partial derivative"]
 - "∆":                                          # 0x2206
     - test: 
         if: "$Verbosity!='Terse'"
         then: [ot: "the"]
     - t: "laplacian of"
 - "∉":                                          # 0x2209
    # rule is identical to 0x2208
     - test:
        if: "$SpeechStyle != 'ClearSpeak'"
        then:
        - test: 
            if: "$Verbosity!='Terse'"
            then: [t: "is"]
        - t: "not an element of"
        # Several options for speaking elements in ClearSpeak -- they split between being inside a set or not and then the option
        else_test:
            if: "../../self::m:set or ../../../self::m:set" # inside a set
            then_test:
              - if: $ClearSpeak_SetMemberSymbol = 'Auto' or $ClearSpeak_SetMemberSymbol = 'In'
                then: [t: "not in"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Member'
                then: [t: "not member of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Element'
                then: [t: "not element of"]
              - else: [t: "not belonging to"]             # $ClearSpeak_SetMemberSymbol = 'Belongs'
            else_test:
              - if: $ClearSpeak_SetMemberSymbol = 'Auto' or $ClearSpeak_SetMemberSymbol = 'Member'
                then: [t: "is not a member of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Element'
                then: [t: "is not an element of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'In'
                then: [t: "is not in"]
              - else: [t: "does not belong to"]              # $ClearSpeak_SetMemberSymbol = 'Belongs'
 - "∊":                                          # 0x220a
     - test:
        if: "$SpeechStyle != 'ClearSpeak'"
        then:
        - test: 
            if: "$Verbosity!='Terse' and not(ancestor::*[self::m:set])"    # "the set x is an element of ..." sounds bad"
            then: [t: "is"]
        - t: "an element of"
        # Several options for speaking elements in ClearSpeak -- they split between being inside a set or not and then the option
        else_test:
            if: "../../self::m:set or ../../../self::m:set" # inside a set
            then_test:
              - if: $ClearSpeak_SetMemberSymbol = 'Auto' or $ClearSpeak_SetMemberSymbol = 'In'
                then: [t: "in"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Member'
                then: [t: "member of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Element'
                then: [t: "element of"]
              - else: [t: "belonging to"]             # $ClearSpeak_SetMemberSymbol = 'Belongs'
            else_test:
              - if: $ClearSpeak_SetMemberSymbol = 'Auto' or $ClearSpeak_SetMemberSymbol = 'Member'
                then: [t: "is a member of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'Element'
                then: [t: "is an element of"]
              - else_if: $ClearSpeak_SetMemberSymbol = 'In'
                then: [t: "is in"]
              - else: [t: "belongs to"]              # $ClearSpeak_SetMemberSymbol = 'Belongs'
 - "√":                                          # 0x221a
     - test: 
         if: "$Verbosity!='Terse'"
         then: [ot: "the"]
     - t: "square root of"
 - "∝":                                          # 0x221d
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "proportional to"
 - "∶":                                          # 0x2236
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "to"
 - "∾":                                          # 0x223e
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "most positive"
 - "≠":                                          # 0x2260
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "not equal to"
 - "≡":                                          # 0x2261
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "identical to"
 - "⊂":                                          # 0x2282
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is a"]
     - t: "subset of"
 - "⊃":                                          # 0x2283
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is a"]
     - t: "superset of"
 - "⊄":                                          # 0x2284
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "not a subset of"
 - "⊅":                                          # 0x2285
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is"]
     - t: "not a superset of"
 - "⊆":                                          # 0x2286
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is a"]
     - t: "subset of or equal to"
 - "⊇":                                          # 0x2287
     - test: 
         if: "$Verbosity!='Terse'"
         then: [t: "is a"]
     - t: "superset of or equal to"

 # --- restored short definitions that differ from unicode-full ---
 - "⇒": [t: "right double arrow"]             # 0x21d2
 - "∐": [t: "co-product"]                          # 0x2210
