Skip to content

Commit 6caa2a1

Browse files
Enhance Norwegian speech for Roman numerals and intent handling
Roman numerals are now spelled out consistently for better pronunciation. Introduces a new `nofix-intent` rule for specific intent properties. Adjusts `function-intent` speech to respect verbosity settings.
1 parent 0ce896d commit 6caa2a1

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

‎Rules/Languages/nb/SharedRules/default.yaml‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242
match: "."
4343
replace:
4444
- bookmark: "@id"
45-
- x: "translate(., $BlockSeparators, '')" # remove digit block separators
45+
- test:
46+
- if: "@data-roman-numeral"
47+
then: [SPELL: "text()", pause: "short"]
48+
else: [x: "translate(., $BlockSeparators, '')"] # remove digit block separators
4649

4750
- name: default
4851
tag: [mo, mtext]
@@ -59,7 +62,7 @@
5962
- test:
6063
- if: "string-length(.) = 1 and text() != '_'" # need unicode.tdl to kick in for single letter tokens
6164
then: [x: "text()"]
62-
- else_if: "@data-chem-element" # NavMode=Character needs this
65+
- else_if: "@data-chem-element or @data-roman-numeral" # NavMode=Character needs this
6366
then: [SPELL: "text()", pause: "short"]
6467
else: [x: "translate(., '-_\u00A0', ' ')"] # from intent literals or from extra spaces added (which get deleted)
6568

@@ -189,7 +192,7 @@
189192
- x: "*[2]"
190193

191194
# Norwegian: Changed this to be more similar to the English rule. Can't find a way to trigger the last "else" statement.
192-
- name: literal
195+
- name: literal # audit-ignore
193196
tag: [msup, msubsup]
194197
match: "."
195198
replace:
@@ -652,6 +655,13 @@
652655
then: [pause: short]
653656
else: [pause: auto]
654657

658+
- name: nofix-intent
659+
# uncaught intent -- the args have been inserted in the order of speech
660+
tag: "*"
661+
match: "contains(@data-intent-property, ':nofix:') "
662+
replace:
663+
- x: "SpeakIntentName(name(.), $Verbosity, 'nofix')"
664+
655665
- name: prefix-intent
656666
# uncaught intent -- the args have been inserted in the order of speech
657667
tag: "*"
@@ -704,14 +714,14 @@
704714
then: [pause: short]
705715
else: [pause: auto]
706716

707-
- name: function-intent
717+
- name: function-intent # audit-ignore
708718
# uncaught intent -- speak as foo of arg1 comma arg2 .... The MathML spec requires arguments to functions
709719
tag: "*"
710720
match: "count(*)>0"
711721
replace:
712722
- x: "SpeakIntentName(name(.), $Verbosity, 'function')"
713723
- test:
714-
if: "not(contains(@data-intent-property, ':literal:')) and
724+
if: "$Verbosity != 'Terse' and not(contains(@data-intent-property, ':literal:')) and
715725
not(count(*)=2 and
716726
(IsInDefinition(*[1], 'Speech', 'TrigFunctionNames') or
717727
IsInDefinition(name(.), 'Speech', 'TerseFunctionNames')) and

‎Rules/Languages/nb/definitions.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"minus": "infix=minus || prefix=minus",
3333
"plus": "infix=pluss || prefix=pluss",
3434
"real-part": "function=den reelle delen",
35+
"set-of-integers": "nofix=mengden av alle heltallene",
3536

3637
"transpose": "postfix=transponert || function=transponert",
3738
#"norm": "function=; normen; slutt norm", # NORWEGIAN: We say "normen til" (the norm to), so this rule is in linear-algebra

0 commit comments

Comments
 (0)