Skip to content

Commit 8a2e617

Browse files
Added rule with name "pause" and rule for "time"
Added the rule with name "pause" Added a test in the rule "per-fraction". If "t" is in a fraction with units, it says "per time".
1 parent 3a31432 commit 8a2e617

2 files changed

Lines changed: 46 additions & 8 deletions

File tree

Rules/Languages/nb/ClearSpeak_Rules.yaml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
---
2+
- name: pause
3+
tag: "!*"
4+
match: "not(self::m:math) and not($MatchingPause) and @data-intent-property[contains(., ':pause')]"
5+
replace:
6+
- with:
7+
variables: [MatchingPause: "true()"]
8+
replace:
9+
- test:
10+
- if: "contains(@data-intent-property, ':pause-long')"
11+
then: [pause: long]
12+
- else_if: "contains(@data-intent-property, ':pause-short')"
13+
then: [pause: short]
14+
else: [pause: medium]
15+
- x: "."
16+
217
- name: intent-literal-silent
318
tag: [mi, mo, mn]
419
match: "contains(@data-intent-property, ':silent:')"
@@ -103,16 +118,20 @@
103118
# Mixed numbers mostly "just work" because the invisible char reads as "and" and other parts read properly on their own
104119

105120
# Units (e.g., meters per second)
106-
#NORWEGIAN: Changed to the English version.
121+
#NORWEGIAN: Changed to the English version. Added rule for t="time"
107122
- name: per-fraction
108123
tag: fraction
109124
match: "$ClearSpeak_Fractions='Per' or
110125
BaseNode(*[1])[contains(@data-intent-property, ':unit') or (self::m:mrow and self::*[3][contains(@data-intent-property, ':unit')])] and
111-
BaseNode(*[1])[contains(@data-intent-property, ':unit') or (self::m:mrow and self::*[3][contains(@data-intent-property, ':unit')])]"
126+
BaseNode(*[2])[contains(@data-intent-property, ':unit') or (self::m:mrow and self::*[3][contains(@data-intent-property, ':unit') or .='t'])]"
112127
replace:
113128
- x: "*[1]"
114129
- T: "per" # phrase('5 meters 'per' second)
115-
- x: "*[2]"
130+
- test:
131+
if: "*[2]='t'"
132+
then: [T: "time"]
133+
else:
134+
- x: "*[2]"
116135

117136
- name: common-fraction
118137
tag: fraction

Rules/Languages/nb/SimpleSpeak_Rules.yaml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
---
2-
2+
- name: pause
3+
tag: "!*"
4+
match: "not(self::m:math) and not($MatchingPause) and @data-intent-property[contains(., ':pause')]"
5+
replace:
6+
- with:
7+
variables: [MatchingPause: "true()"]
8+
replace:
9+
- test:
10+
- if: "contains(@data-intent-property, ':pause-long')"
11+
then: [pause: long]
12+
- else_if: "contains(@data-intent-property, ':pause-short')"
13+
then: [pause: short]
14+
else: [pause: medium]
15+
- x: "."
16+
317
- name: intent-literal-silent
418
tag: [mi, mo, mn]
519
match: "contains(@data-intent-property, ':silent:')"
@@ -77,15 +91,20 @@
7791
- x: "ToOrdinal(*[2], true(), $IsPlural)" # extra args specify fractional ordinal and whether it is plural
7892

7993
# Units (e.g., meters per second)
80-
# NORWEGIAN: Added this rule from English version
94+
# NORWEGIAN: Added this rule from English version. Added rule for t="time"
8195
- name: per-fraction
8296
tag: fraction
83-
match: "BaseNode(*[1])[contains(@data-intent-property, ':unit') or (self::m:mrow and self::*[3][contains(@data-intent-property, ':unit')])] and
84-
BaseNode(*[1])[contains(@data-intent-property, ':unit') or (self::m:mrow and self::*[3][contains(@data-intent-property, ':unit')])]"
97+
match: "$ClearSpeak_Fractions='Per' or
98+
BaseNode(*[1])[contains(@data-intent-property, ':unit') or (self::m:mrow and self::*[3][contains(@data-intent-property, ':unit')])] and
99+
BaseNode(*[2])[contains(@data-intent-property, ':unit') or (self::m:mrow and self::*[3][contains(@data-intent-property, ':unit') or .='t'])]"
85100
replace:
86101
- x: "*[1]"
87102
- T: "per" # phrase('5 meters 'per' second)
88-
- x: "*[2]"
103+
- test:
104+
if: "*[2]='t'"
105+
then: [T: "time"]
106+
else:
107+
- x: "*[2]"
89108

90109
- name: simple
91110
# don't include nested fractions. E.g, fraction a plus b over c + 1 end fraction" is ambiguous

0 commit comments

Comments
 (0)