Skip to content

Commit 1dc93e7

Browse files
Merge branch 'NSoiffer:main' into main
2 parents fdb7ae5 + 6da2c21 commit 1dc93e7

File tree

34 files changed

+539
-324
lines changed

34 files changed

+539
-324
lines changed

Rules/Languages/en/ClearSpeak_Rules.yaml

Lines changed: 37 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
if: "$Verbosity!='Terse'"
3737
then: [t: "the"] # phrase('the' square root of 25)
3838
- test:
39-
if: $ClearSpeak_Roots = 'PosNegSqRoot' or $ClearSpeak_Roots = 'PosNegSqRootEnd'
39+
if: "$ClearSpeak_Roots = 'PosNegSqRoot' or $ClearSpeak_Roots = 'PosNegSqRootEnd'"
4040
then:
4141
- bookmark: "*[1]/@id"
4242
- test:
43-
if: parent::*[self::m:minus and count(*)=1]
43+
if: "parent::*[self::m:minus and count(*)=1]"
4444
then: [t: "negative"] # phrase(minus 4 is a 'negative' number)
4545
else: [t: "positive"] # phrase(10 is a 'positive' number)
4646
- t: "square root" # phrase(8 is the 'square root' of 64)
@@ -67,13 +67,13 @@
6767
if: "$Verbosity!='Terse'"
6868
then: [t: "the"] # phrase(6 is 'the' square root of 36)
6969
- test:
70-
if: $ClearSpeak_Roots = 'PosNegSqRoot' or $ClearSpeak_Roots = 'PosNegSqRootEnd'
70+
if: "$ClearSpeak_Roots = 'PosNegSqRoot' or $ClearSpeak_Roots = 'PosNegSqRootEnd'"
7171
then:
7272
- test:
7373
if: "parent::*[(self::m:minus or self::m:plus) and count(*)=1]"
7474
then: [bookmark: "parent/@id"]
7575
- test:
76-
if: parent::m:minus
76+
if: "parent::m:minus"
7777
then: [t: "negative"] # phrase(minus 6 is a 'negative' number)
7878
else: [t: "positive"] # phrase(10 is a 'positive' number)
7979
- test:
@@ -89,21 +89,21 @@
8989
if: "*[2][self::m:mi][string-length(.)=1]"
9090
then:
9191
- x: "*[2]"
92-
- pronounce: [{text: "-th"}, {ipa: "θ"}, {sapi5: "th"}, {eloquence: "T"}]
93-
else: {x: "*[2]"}
92+
- pronounce: [text: "-th", ipa: "θ", sapi5: "th", eloquence: "T"]
93+
else: [x: "*[2]"]
9494
- t: "root" # phrase(the square 'root' of 36)
9595
- test:
9696
if: "$Verbosity!='Terse'"
9797
then: [t: "of"] # phrase(the square root 'of' 36)
9898
- x: "*[1]"
9999
- test:
100-
if: $ClearSpeak_Roots = 'RootEnd' or $ClearSpeak_Roots = 'PosNegSqRootEnd'
100+
if: "$ClearSpeak_Roots = 'RootEnd' or $ClearSpeak_Roots = 'PosNegSqRootEnd'"
101101
then:
102102
- pause: short
103103
- t: "end root" # phrase(start the fifth root of x 'end root')
104104
- pause: medium
105105
else_test:
106-
if: IsNode(*[1], 'simple')
106+
if: "IsNode(*[1], 'simple')"
107107
then: [pause: short]
108108
else: [pause: long]
109109

@@ -116,7 +116,7 @@
116116
if:
117117
- "*[1][self::m:square-root or self::m:root] and"
118118
- "($ClearSpeak_Roots = 'PosNegSqRoot' or $ClearSpeak_Roots = 'PosNegSqRootEnd')"
119-
then: {t: ""}
119+
then: [t: ""]
120120
else:
121121
- bookmark: "@id"
122122
- test:
@@ -146,8 +146,8 @@
146146
tag: fraction
147147
match:
148148
- "($ClearSpeak_Fractions='Auto' or $ClearSpeak_Fractions='Ordinal' or $ClearSpeak_Fractions='EndFrac') and"
149-
- "*[1][self::m:mn][not(contains(., '.')) and ($ClearSpeak_Fractions='Ordinal' or text()<20)] and"
150-
- "*[2][self::m:mn][not(contains(., '.')) and ($ClearSpeak_Fractions='Ordinal' or (2<= text() and text()<=10))]"
149+
- "*[1][self::m:mn][not(contains(., $DecimalSeparators)) and ($ClearSpeak_Fractions='Ordinal' or text()<20)] and"
150+
- "*[2][self::m:mn][not(contains(., $DecimalSeparators)) and ($ClearSpeak_Fractions='Ordinal' or (2<= text() and text()<=10))]"
151151
variables: [IsPlural: "*[1]!=1"]
152152
replace:
153153
- x: "*[1]"
@@ -226,7 +226,7 @@
226226
- ot: "the" # phrase(5 is 'the' square toot of 25)
227227
- t: "fraction with numerator" # phrase(the 'fraction with numerator' 6)
228228
- test:
229-
if: not(IsNode(*[1], 'simple'))
229+
if: "not(IsNode(*[1], 'simple'))"
230230
then: [pause: medium]
231231
- x: "*[1]"
232232
- pause: medium
@@ -248,10 +248,10 @@
248248
match: "."
249249
replace:
250250
- test:
251-
if: $ClearSpeak_Trig = 'TrigInverse'
252-
then: [{x: "*[1]"}, {bookmark: "*[2]/@id"}, t: "inverse"] # phrase(8 over 5 is the 'inverse' of 5 over 8)
251+
if: "$ClearSpeak_Trig = 'TrigInverse'"
252+
then: [x: "*[1]", bookmark: "*[2]/@id", t: "inverse"] # phrase(8 over 5 is the 'inverse' of 5 over 8)
253253
else_test:
254-
if: $ClearSpeak_Trig = 'ArcTrig'
254+
if: "$ClearSpeak_Trig = 'ArcTrig'"
255255
then: [bookmark: "*[2]/@id", t: "arc", x: "*[1]"] # phrase(the 'arc' of a circle)
256256
else: [bookmark: "*[2]/@id", t: "inverse", x: "*[1]"] # default/Auto # phrase(8 over 5 is the 'inverse' of 5 over 8)
257257

@@ -331,8 +331,8 @@
331331
- t: "to the" # phrase(2 raised 'to the' power 7)
332332
- test:
333333
if: "*[2][.>0]"
334-
then: {x: "ToOrdinal(*[2])"}
335-
else: {x: "*[2]"}
334+
then: [x: "ToOrdinal(*[2])"]
335+
else: [x: "*[2]"]
336336
- test:
337337
if: "$ClearSpeak_Exponents != 'Ordinal'"
338338
then: [t: "power"] # phrase(2 raised to the 'power' 7)
@@ -358,7 +358,7 @@
358358
- x: "*[1]"
359359
- t: "to the" # phrase(3 raised 'to the' power 7)
360360
- x: "*[2]"
361-
- pronounce: [{text: "-th"}, {ipa: "θ"}, {sapi5: "th"}, {eloquence: "T"}]
361+
- pronounce: [text: "-th", ipa: "θ", sapi5: "th", eloquence: "T"]
362362
- test:
363363
if: "$ClearSpeak_Exponents != 'Ordinal'"
364364
then: [t: "power"] # phrase(2 raised to the 'power' 7)
@@ -523,14 +523,14 @@
523523
then: [t: "the"] # phrase('the' set of all integers)
524524
- t: "set of" # phrase(this is a 'set of' numbers)
525525
- test:
526-
if: $ClearSpeak_Sets != 'woAll'
526+
if: "$ClearSpeak_Sets != 'woAll'"
527527
then: [t: "all"] # phrase(the set of 'all' integers)
528528
- x: "*[1]/*[1]"
529529
- t: "such that" # phrase(the set S 'such that' x is less than y)
530530
- x: "*[1]/*[3]"
531531
else:
532532
- test:
533-
if: $ClearSpeak_Sets != 'SilentBracket'
533+
if: "$ClearSpeak_Sets != 'SilentBracket'"
534534
then:
535535
- test:
536536
if: "$Verbosity!='Terse'"
@@ -573,11 +573,11 @@
573573
else: [t: "but"] # phrase(the interval including a 'but' not b)
574574
# some ugly logic dealing with connectives: or, but, but, and (cleaner to be part of next clause?)
575575
- test:
576-
if: not($is_intervals_end_infinity)
576+
if: "not($is_intervals_end_infinity)"
577577
then:
578578
- test:
579579
# there is some asymmetry to the test because of the and/or/but logic above
580-
if: not( name(.)='open-interval' or name(.)='closed-interval' ) or $is_intervals_start_infinity
580+
if: "not( name(.)='open-interval' or name(.)='closed-interval' ) or $is_intervals_start_infinity"
581581
then:
582582
- test:
583583
if: "name(.) = 'open-interval' or name(.) = 'closed-open-interval'"
@@ -605,47 +605,32 @@
605605
- t: "row" # phrase(the first 'row' of a matrix)
606606
- x: "count(preceding-sibling::*)+1"
607607
- test:
608-
if: .[self::m:mlabeledtr]
608+
if: ".[self::m:mlabeledtr]"
609609
then:
610610
- t: "with label" # phrase(the line 'with label' first equation)
611611
- x: "*[1]/*"
612612
- pause: short
613613
- pause: medium
614614
- test:
615-
if: .[self::m:mlabeledtr]
615+
if: ".[self::m:mlabeledtr]"
616616
then: [x: "*[position()>1]"]
617-
else: {x: "*"}
617+
else: [x: "*"]
618618

619619
- # handle both log and ln
620620
name: ClearSpeak-log
621-
tag: mrow
622-
variables: [{log_is_simple: "IsNode(*[3],'simple')"}]
623-
match:
624-
- "count(*)=3 and"
625-
- "*[1][self::m:mi][.='log' or .='ln'] and"
626-
- "*[2][self::m:mo][.='⁡']"
621+
tag: mi
622+
match: ".='log' or .='ln'"
627623
replace:
624+
- bookmark: "@id"
628625
- test:
629-
if: "$log_is_simple"
630-
then_test:
631-
- if: "*[1][.='log']"
632-
then: [t: "log"] # phrase(the 'log' of x)
633-
- else_if: $ClearSpeak_Log = 'LnAsNaturalLog'
634-
then: [t: "natural log"] # phrase(the 'natural log' of the product of 2 numbers)
635-
else: [spell: "'ln'"]
636-
else:
637-
- test:
638-
if: "$Verbosity!='Terse' and not(log_is_simple)"
639-
then: [t: "the"] # phrase('the' square root of 25)
640-
- test:
641-
- if: "*[1][.='log']"
642-
then: [t: "log"]
643-
- else_if: $ClearSpeak_Log = 'LnAsNaturalLog'
644-
then: [t: "natural log"] # phrase(the 'natural log' of x)
645-
else: [spell: "'ln'"]
646-
- t: "of" # phrase(the natural log 'of' x)
647-
- pause: short
648-
- x: "*[3]"
626+
if: "$Verbosity!='Terse' and not(IsNode(following-sibling::*[2],'simple'))"
627+
then: [t: "the"] # phrase('the' square root of 25)
628+
- test:
629+
- if: ".='log'"
630+
then: [t: "log"]
631+
- else_if: "$ClearSpeak_Log = 'LnAsNaturalLog'"
632+
then: [t: "natural log"] # phrase(the 'natural log' of x)
633+
else: [spell: "'ln'"]
649634

650635
- name: ClearSpeak-multi-line
651636
tag: [piecewise, system-of-equations, lines] # these are ignored in favor of the ClearSpeak prefs
@@ -657,7 +642,7 @@
657642
- IsColumnSilent: true()
658643
replace:
659644
- test:
660-
- if: $ClearSpeak_MultiLineOverview = 'Auto'
645+
- if: "$ClearSpeak_MultiLineOverview = 'Auto'"
661646
then:
662647
- x: "$LineCount"
663648
- test:

Rules/Languages/en/SharedRules/general.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@
228228
- x: "*[3]"
229229
- pause: short
230230

231+
# in terse mode, we just say "m" or "s", etc., not meters or seconds
232+
- name: unit-terse
233+
tag: unit
234+
match: "$Verbosity = 'Terse' and string-length(.)=1"
235+
replace:
236+
- bookmark: "@id"
237+
- spell: "text()"
231238

232239
# the order of matching is
233240
# 1. does it match the base of an SI unit
@@ -236,7 +243,7 @@
236243
# Due to this order, some things like "ft" and "cd" mean "feet" vs "femto-tonnes" and "pints" vs "pico-tonnes"
237244
- name: unit
238245
tag: unit
239-
match: "$Verbosity != 'Terse' and contains(@data-intent-property, ':unit')"
246+
match: "."
240247
variables:
241248
# If the coefficient is singular, we don't add the plural ending. Finding the coefficient is tricky
242249
# Normal case (A) "3m" (parents is mrow), but could also be (B) "3 m^2" (etc.) (parent is power/mrow)
@@ -250,7 +257,7 @@
250257
IfThenElse(parent::m:power, ancestor::*[2][self::m:mrow],
251258
IfThenElse(parent::m:fraction and not(preceding-sibling::*), ancestor::*[2][self::m:mrow],
252259
IfThenElse(parent::m:power[parent::m:fraction and not(preceding-sibling::*)], ancestor::*[3][self::m:mrow], false()) ) ) )"
253-
- IsSingular: "(not(DEBUG($MRowForCoefficient)) and parent::*[name(.)!='skip-super' or *[1][.=1]]) or
260+
- IsSingular: "(not($MRowForCoefficient) and parent::*[name(.)!='skip-super' or *[1][.=1]]) or
254261
($MRowForCoefficient and $MRowForCoefficient[(count(*) = 3 and *[1][self::m:mn and .=1] and *[2]='\u2062')])"
255262
- Prefix: "''"
256263
- Word: "''"
@@ -448,7 +455,6 @@
448455
- test:
449456
- if: "$Verbosity!='Terse'"
450457
then: [t: "the"] # phrase('the' logarithm function is used in mathematics)
451-
452458
- test:
453459
- if: ".= 'log'"
454460
then: [t: "log"] # phrase(the 'log' function is used in mathematics)

Rules/Languages/en/unicode.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,11 @@
178178
- test:
179179
- if: "$SpeechStyle != 'ClearSpeak'"
180180
then_test:
181-
if: "$DefaultToGiven"
181+
- if: "$DefaultToGiven"
182182
then: [t: "given"]
183+
- else_if: "preceding-sibling::*[1][self::m:mn and not(contains(., $DecimalSeparators))] and
184+
following-sibling::*[1][self::m:mn and not(contains(., $DecimalSeparators))]"
185+
then: [t: "divides"]
183186
else: [t: "vertical line"]
184187
- else_if: "not(preceding-sibling::*) or not(following-sibling::*)"
185188
then: [t: "vertical line"]
@@ -301,8 +304,15 @@
301304
- "": # 0x2061
302305
- test:
303306
# skip saying "of" when Terse and a trig function, when it is a shape (does this happen?), or we are in :literal mode
304-
if: "not($Verbosity='Terse' and preceding-sibling::*[1][IsInDefinition(., 'TrigFunctionNames')]) and not(preceding-sibling::*[1][IsInDefinition(., 'GeometryShapes')]) and
305-
not(@data-changed='added' and ancestor-or-self::*[contains(@data-intent-property, ':literal:')])"
307+
if: "not(
308+
( $Verbosity='Terse' or ($SpeechStyle = 'ClearSpeak' and IsNode(following-sibling::*[1],'simple')) and
309+
preceding-sibling::*[1][IfThenElse($SpeechStyle='ClearSpeak',
310+
IsInDefinition(., 'ClearSpeakTrigFunctionNames'),
311+
IsInDefinition(., 'TrigFunctionNames') )]
312+
) or
313+
preceding-sibling::*[1][IsInDefinition(., 'GeometryShapes')] or
314+
(@data-changed='added' and ancestor-or-self::*[contains(@data-intent-property, ':literal:')])
315+
)"
306316
then: [t: "of"]
307317
- "": [t: ""] # 0x2062
308318
- "": [t: ""] # 0x2063

Rules/Languages/es/ClearSpeak_Rules.yaml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -620,34 +620,19 @@
620620

621621
- # handle both log and ln
622622
name: ClearSpeak-log
623-
tag: mrow
624-
variables: [{log_is_simple: "IsNode(*[3],'simple')"}]
625-
match:
626-
- "count(*)=3 and"
627-
- "*[1][self::m:mi][.='log' or .='ln'] and"
628-
- "*[2][self::m:mo][.='⁡']"
623+
tag: mi
624+
match: ".='log' or .='ln'"
629625
replace:
626+
- bookmark: "@id"
630627
- test:
631-
if: "$log_is_simple"
632-
then_test:
633-
- if: "*[1][.='log']"
634-
then: [{T: "log"}]
635-
- else_if: $ClearSpeak_Log = 'LnAsNaturalLog'
636-
then: [{T: "logaritmo natural"}]
637-
else: [{spell: "'ln'"}]
638-
else:
639-
- test:
640-
if: "$Verbosity!='Terse' and not(log_is_simple)"
641-
then: {T: "el"}
642-
- test:
643-
- if: "*[1][.='log']"
644-
then: [{T: "log"}]
645-
- else_if: $ClearSpeak_Log = 'LnAsNaturalLog'
646-
then: [{T: "logaritmo natural"}]
647-
else: [{spell: "'ln'"}]
648-
- T: "de"
649-
- pause: short
650-
- x: "*[3]"
628+
if: "$Verbosity!='Terse' and not(IsNode(following-sibling::*[2],'simple'))"
629+
then: [T: "el"] # phrase('the' square root of 25)
630+
- test:
631+
- if: ".='log'"
632+
then: [T: "log"]
633+
- else_if: "$ClearSpeak_Log = 'LnAsNaturalLog'"
634+
then: [T: "logaritmo natural"] # phrase(the 'natural log' of x)
635+
else: [spell: "'ln'"]
651636

652637
- name: ClearSpeak-multi-line
653638
tag: [piecewise, system-of-equations, lines] # these are ignored in favor of the ClearSpeak prefs

Rules/Languages/es/SharedRules/general.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
# Due to this order, some things like "ft" and "cd" mean "feet" vs "femto-tonnes" and "pints" vs "pico-tonnes"
227227
- name: unit
228228
tag: unit
229-
match: "$Verbosity != 'Terse' and contains(@data-intent-property, ':unit')"
229+
match: "."
230230
variables:
231231
# If the coefficient is singular, we don't add the plural ending. Finding the coefficient is tricky
232232
# Normal case (A) "3m" (parents is mrow), but could also be (B) "3 m^2" (etc.). (parent is msup/mrow)
@@ -424,7 +424,6 @@
424424
- test:
425425
- if: "$Verbosity!='Terse'"
426426
then: [T: "el"] # phrase('the' logarithm function is used in mathematics)
427-
428427
- test:
429428
- if: ".= 'log'"
430429
then: [T: "log"] # phrase(the 'log' function is used in mathematics)

Rules/Languages/es/unicode.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,18 @@
246246
then: [T: "etcétera"] # (en: 'and so on', google translation)
247247
else: [T: "puntos suspensivos"] # (en: 'and so on up to', MathPlayer: 'punto punteado punteado', google: 'y así sucesivamente')
248248

249-
- "": # 0x2061
249+
- "": # 0x2061
250250
- test:
251-
if: "$Verbosity!='Terse' and not(preceding-sibling::*[1][IsInDefinition(., 'GeometryShapes')])"
251+
# skip saying "of" when Terse and a trig function, when it is a shape (does this happen?), or we are in :literal mode
252+
if: "not(
253+
( $Verbosity='Terse' or ($SpeechStyle = 'ClearSpeak' and IsNode(following-sibling::*[1],'simple')) and
254+
preceding-sibling::*[1][IfThenElse($SpeechStyle='ClearSpeak',
255+
IsInDefinition(., 'ClearSpeakTrigFunctionNames'),
256+
IsInDefinition(., 'TrigFunctionNames') )]
257+
) or
258+
preceding-sibling::*[1][IsInDefinition(., 'GeometryShapes')] or
259+
(@data-changed='added' and ancestor-or-self::*[contains(@data-intent-property, ':literal:')])
260+
)"
252261
then: [T: "de"] # (en: 'of', google translation)
253262
- "": [T: ""] # 0x2062
254263
- "": [T: ""] # 0x2063

0 commit comments

Comments
 (0)