Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Rules/Languages/en/unicode-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@
- "✓": [t: "check mark"] # 0x2713
- "✠": [t: "maltese cross"] # 0x2720
- "✪": [t: "circled white star"] # 0x272a
- "✶": [t: "six pionted black star"] # 0x2736
- "✶": [t: "six pointed black star"] # 0x2736
- "❨": [t: "medium left parentheses ornament"] # 0x2768
- "❩": [t: "medium right parentheses ornament"] # 0x2769
- "❪": [t: "medium flattened left parentheses ornament"] # 0x276a
Expand Down
167 changes: 98 additions & 69 deletions Rules/Languages/sv/ClearSpeak_Rules.yaml

Large diffs are not rendered by default.

28 changes: 22 additions & 6 deletions Rules/Languages/sv/SharedRules/calculus.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
---

- name: laplacian
tag: laplacian
match: "count(*) <= 1" # can be on ∇^2 or on enclosing mrow
replace:
- T: "laplacianen" # phrase('laplacian' of x) -- "LahPlahsian" sounds better with speech engines tested
- test:
if: "count(*) = 1"
then:
- test:
if: "$Verbosity!='Terse'"
then: [T: "av"] # phrase(function 'of' one variable) -- note OneCore voices spell out "div"
- test:
if: "not(IsNode(*[1], 'leaf'))"
then: [pause: short]
- x: "*[1]"

- name: divergence
tag: divergence
match: "."
replace:
- test:
if: "$Verbosity='Verbose'"
then: [t: "divergence"] # phrase('divergence' from the mean)
else: [t: "div"] # phrase('divergence' from the mean)
- t: "of" # phrase(systems 'of' linear equations)
then: [T: "divergensen"] # phrase('divergence' from the mean)
else: [T: "div"] # phrase('divergence' from the mean)
- T: "av" # phrase(systems 'of' linear equations)
- test:
if: "not(IsNode(*[1], 'leaf'))"
then: [pause: short]
Expand All @@ -18,7 +34,7 @@
tag: curl
match: "."
replace:
- t: "curl of" # phrase(the 'curl of' a field)
- T: "rotationen av" # phrase(the 'curl of' a field)
- test:
if: "not(IsNode(*[1], 'leaf'))"
then: [pause: short]
Expand All @@ -30,8 +46,8 @@
replace:
- test:
if: "$Verbosity!='Terse'"
then: [t: "gradient of"] # phrase('divergence' from the mean)
else: [t: "del"] # phrase('divergence' from the mean)
then: [T: "gradienten av"] # phrase('divergence' from the mean)
else: [T: "dell"] # phrase('divergence' from the mean)
- test:
if: "not(IsNode(*[1], 'leaf'))"
then: [pause: short]
Expand Down
128 changes: 64 additions & 64 deletions Rules/Languages/sv/SharedRules/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
replace:
- with:
variables:
- ClearSpeak_Fractions: "IFTHENELSE($Verbosity='Verbose' and $ClearSpeak_Fractions='Auto', 'EndFrac', $ClearSpeak_Fractions)"
- ClearSpeak_AbsoluteValue: "IFTHENELSE($Verbosity='Verbose' and $ClearSpeak_AbsoluteValue='Auto', 'AbsEnd', $ClearSpeak_AbsoluteValue)"
- ClearSpeak_Roots: "IFTHENELSE($Verbosity='Verbose' and $ClearSpeak_Roots='Auto', 'RootEnd', $ClearSpeak_Roots)"
- ClearSpeak_Matrix: "IFTHENELSE($Verbosity='Verbose' and $ClearSpeak_Matrix='Auto', 'EndMatrix', $ClearSpeak_Matrix)"
- ClearSpeak_Fractions: "IfThenElse($Verbosity='Verbose' and $ClearSpeak_Fractions='Auto', 'EndFrac', $ClearSpeak_Fractions)"
- ClearSpeak_AbsoluteValue: "IfThenElse($Verbosity='Verbose' and $ClearSpeak_AbsoluteValue='Auto', 'AbsEnd', $ClearSpeak_AbsoluteValue)"
- ClearSpeak_Roots: "IfThenElse($Verbosity='Verbose' and $ClearSpeak_Roots='Auto', 'RootEnd', $ClearSpeak_Roots)"
- ClearSpeak_Matrix: "IfThenElse($Verbosity='Verbose' and $ClearSpeak_Matrix='Auto', 'EndMatrix', $ClearSpeak_Matrix)"

- MatchingPause: false()
# should be set at mtable level, but unknown intents make that impossible to know
- IsColumnSilent: false()
replace:
Expand Down Expand Up @@ -55,9 +57,11 @@
replace:
- bookmark: "@id"
- test:
if: "string-length(.) = 1 and text() != '_'" # need unicode.tdl to kick in for single letter tokens
- if: "string-length(.) = 1 and text() != '_'" # need unicode.tdl to kick in for single letter tokens
then: [x: "text()"]
else: [x: "translate(., '-_', ' ')" ] # from intent literals
- else_if: "@data-chem-element" # NavMode=Character needs this
then: [SPELL: "text()", pause: "short"]
else: [x: "translate(., '-_\u00A0', ' ')"] # from intent literals or from extra spaces added (which get deleted)

- name: default
tag: ms
Expand All @@ -72,8 +76,7 @@
match: "."
replace: [x: "*"]


- name: structure-simple
- name: literal-simple
# don't include nested fractions. E.g, fraction a plus b over c + 1 end fraction" is ambiguous
# by simplistic SimpleSpeak's rules "b over c" is a fraction, but if we say nested fractions
# are never simple, then any 'over' applies only to enclosing "fraction...end fraction" pair.
Expand All @@ -87,7 +90,7 @@
- x: "*[2]"
- pause: short

- name: structure-default
- name: literal-default
tag: mfrac
match: "."
replace:
Expand All @@ -103,74 +106,77 @@
then: [pause: short]
- x: "*[2]"
- pause: short
- T: "slut division" # phrase("start of fraction x over y 'end over'")
- test:
if: "$Impairment = 'Blindness'"
then: [T: "slut bråk"] # phrase("start of fraction x over y 'end over'")
- pause: medium


# not sure what really should be said for these since we should not assume they are square roots
- name: structure-default
- name: literal-default # audit-ignore
tag: msqrt
match: "."
replace:
- T: "rotsymbolen"
- test:
if: "$Verbosity!='Terse'"
then: [T: "ur"] # phrase("the root 'of' x")
- T: "roten ur"
- x: "*[1]"
- pause: short
- test:
if: "not(IsNode(*[1],'leaf'))"
then: [T: "slut rotsymbol"] # phrase("root of x 'end root symbol'")
if: "not(IsNode(*[1],'leaf')) or $Impairment = 'Blindness'"
then: [T: "slut rot", pause: medium] # phrase("root of x 'end root symbol'")

# not sure what really should be said for these since we should not assume they are square roots
- name: structure-default
- name: literal-default # audit-ignore
tag: mroot
match: "."
replace:
- T: "rotsymbolen"
- T: "med index" # phrase("the root of x 'with index' 5")
- T: "rot med index" # phrase("the 'root with index' 3 of 5")
- x: "*[1]"
# SWEDISH: Check if the order of base and index is correct!
- pause: short
- test:
if: "$Verbosity!='Terse'"
then: [T: "ur"] # phrase("the root 'of' x")
- T: "ur" # phrase("the root 'of' x")
- x: "*[2]"
- pause: short
- test:
if: "not(IsNode(*[2],'leaf'))"
then: [T: "slut rotsymbol"] # phrase("root of x 'end root symbol'")
then: [T: "slut rot"] # phrase("root of x 'end root symbol'")


- name: simple-sub
- name: simple-sub # audit-ignore
tag: indexed-by
# invisible comma -- want "x 1 when subscript is an integer"
match: "count(*)=2 and $Verbosity='Terse' and *[2][self::m:mn and translate(., '.,', '')=.]"
# SWEDISH: want to skip announcing "index" not only when integer but also the index consists of one single character
match: "count(*)=2 and $Verbosity='Terse' and IsNode(*[2], 'leaf') and ( (*[2][self::m:mn and translate(., '.,', '')=.]) or string-length(*[2])=1 )"
replace:
- x: "*[1]"
- x: "*[2]"
- pause: short

- name: no-end-sub
tag: indexed-by
# invisible comma -- want "x 1 when subscript is an integer"
match: "count(*)=2 and (IsNode(*[2], 'leaf') or *[2][self::m:mrow][*[2][.='⁣']])"
match: "count(*)=2 and *[2][self::m:mrow and *[2][.='⁣']]"
replace:
- x: "*[1]"
- test:
if: "$Verbosity!='Terse' or not(*[2][self::m:mn])" # just say "x 1" for terse vs "x sub 1"
then: [T: "nedsänkt"] # phrase(x 'sub' 2)
- T: "nedsänkt" # phrase(x 'sub' 2)
- x: "*[2]"
- pause: short

- name: power-indexed-by
tag: power-indexed-by
match: "."
replace:
- x: "*[1]"
- T: "nedsänkt" # phrase(x 'sub' 2)
- x: "*[2]"
- pause: short

- name: structure
- name: literal
tag: msub
match: "."
replace:
- x: "*[1]"
- T: "nedsänkt" # phrase(x 'sub' 2)
- test:
if: "not($Verbosity='Terse' and *[2][self::m:mn and not(translate(., '.,', '')!=.)])" # just say "x 1" for terse vs "x sub 1"
then: [T: "nedsänkt"] # phrase(x 'sub' 2)
- x: "*[2]"

- name: structure
- name: literal
tag: [msup, msubsup]
match: "."
replace:
Expand All @@ -184,34 +190,26 @@
if: "*[last()][translate(., '′″‴⁗†‡°*', '')='']"
then: [x: "*[last()]"]
else_test:
if: "ancestor-or-self::*[contains(@data-intent-property, ':structure:')]" # FIX: is this test necessary?
if: "ancestor-or-self::*[contains(@data-intent-property, ':literal:')]" # FIX: is this test necessary?
then:
- T: "upphöjt" # phrase(x 'super' 2)
- x: "*[last()]"
- test:
if: "not(IsNode(*[last()], 'simple'))"
if: "not(IsNode(*[last()], 'simple')) or $Impairment = 'Blindness'"
then: [T: "slut upphöjt"] # phrase(x super 2 'end of super')
else:
- T: "upphöjt till" # phrase(5 'raised to the' second power equals 25)
- test:
if: "$Verbosity='Verbose'"
then: [T: "övre index"]
else: [T: "upphöjt"]
- x: "*[last()]"
# - t: "power" # phrase(5 raised to the second 'power' equals 25)

# - name: default
# tag: munder
# match: "."
# replace:
# - test:
# if: "not(IsNode(*[1], 'leaf'))"
# then: [T: "kommenterat uttryck"] # phrase(phrase(x 'modified' with y above it)
# - x: "*[1]"
# - pause: short
# - T: "med kommentar under" # phrase(x 'with' z below it)
# - pause: short
# - x: "*[2]"
# - pause: short
# - T: "slut kommentar" # phrase(x with z 'below' it)
- test:
if: "$Verbosity='Verbose'"
then: [T: "slut övre index"]
else: [T: "slut upphöjt"]

- name: default
# SWEDISH: adapted the rule for less verbose speaking of expressions with a brace under them and then with something under the brace
- name: default # audit-ignore
tag: munder
match: "."
replace:
Expand Down Expand Up @@ -243,7 +241,7 @@

- name: diacriticals
tag: mover
match: "*[1][self::m:mi] and *[2][translate(., '\u0306\u030c.\u00A8\u02D9\u20DB\u20DC`^~→¯_', '')='']"
match: "*[1][self::m:mi] and *[2][translate(., '\u0306\u030c.\u00A8\u02D9\u20DB\u20DC`^ˇ~→¯_', '')='']"
replace:
- x: "*[1]"
- x: "*[2]"
Expand Down Expand Up @@ -282,11 +280,12 @@
- pause: short
- T: "slut kommentar" # phrase(x modified with y 'above' it)

- name: default
- name: default # audit-ignore
# Here we support up to 2 prescripts and up to 4 postscripts -- that should cover all reasonable cases
# If there are more, we just dump them out without regard to sup/super :-(
# FIX: this could use more special cases
# There is (currently) no way in MathCAT to deal with n-ary arguments other than "all" ('*') or an individual entry ('*[1]').
# SWEDISH: announce "left index" also if there are no right indexes
tag: mmultiscripts
match: "."
variables:
Expand Down Expand Up @@ -371,9 +370,10 @@
else:
- test:
if: "$Prescripts"
then: [T: "och"]
- T: "höger index"
- pause: short
then:
- T: "och"
- T: "höger index"
- pause: short
- test:
if: "not($Postscripts[1][self::m:none])"
then:
Expand Down Expand Up @@ -458,7 +458,7 @@
- T: "och" # phrase(the table with 3 rows 'and' 4 columns)
- x: "$NumColumns"
- test:
if: "$NumColumns"
if: "NumColumns=1"
then: [T: "kolumn"] # phrase(the table with 3 rows and 1 'column')
else: [T: "kolumner"] # phrase(the table with 3 rows and 4 'columns')
- pause: long
Expand Down Expand Up @@ -716,7 +716,7 @@
then: [pause: short]
else: [pause: auto]

- name: function-intent
- name: function-intent # audit-ignore
# uncaught intent -- speak as foo of arg1 comma arg2 .... The MathML spec requires arguments to functions
tag: "*"
match: "count(*)>0"
Expand Down
Loading
Loading