|
1 | 1 | --- |
2 | | -# audit-ignore |
3 | 2 | - name: pause |
4 | 3 | tag: "!*" |
5 | 4 | match: "not(self::m:math) and not($MatchingPause) and @data-intent-property[contains(., ':pause')]" |
|
14 | 13 | then: [pause: short] |
15 | 14 | else: [pause: medium] |
16 | 15 | - x: "." |
17 | | - |
18 | | -# audit-ignore |
| 16 | + |
19 | 17 | - name: intent-literal-silent |
20 | 18 | tag: [mi, mo, mn] |
21 | 19 | match: "contains(@data-intent-property, ':silent:')" |
22 | 20 | # say nothing |
23 | 21 | replace: [] |
24 | 22 |
|
25 | | -# audit-ignore |
26 | 23 | # handling of negative numbers that come from 'intent' is hard -- we do something that is close to right here |
27 | 24 | - name: intent-literal-negative-number |
28 | 25 | tag: mn |
|
31 | 28 | - T: "minus" # phrase(x 'minus' y) |
32 | 29 | - x: "translate(text(), '-_', '')" |
33 | 30 |
|
34 | | -# audit-ignore |
35 | | -- name: default |
| 31 | +- name: default # audit-ignore |
36 | 32 | tag: square-root |
37 | 33 | match: "." |
38 | 34 | replace: |
|
46 | 42 | then: [pause: short] |
47 | 43 | else: [pause: short, T: "slutt rot", pause: short] # phrase(start the square root of x 'end of root') |
48 | 44 |
|
49 | | -# audit-ignore |
50 | | -- name: default |
| 45 | +- name: default # audit-ignore |
51 | 46 | tag: root |
52 | 47 | match: "." |
53 | 48 | replace: |
|
71 | 66 | then: [pause: short] |
72 | 67 | else: [pause: short, T: "slutt rot", pause: short] # phrase(start the fifth root of x 'end of root') |
73 | 68 |
|
74 | | -# audit-ignore |
75 | 69 | # Fraction rules |
76 | 70 | # Mixed numbers mostly "just work" because the invisible char reads as "and" and other parts read properly on their own |
77 | 71 | # Note: if the bounds change for what is a common fraction, change them in general.yaml for units |
78 | | -- name: common-fraction |
| 72 | +- name: common-fraction # audit-ignore |
79 | 73 | tag: fraction |
80 | 74 | match: |
81 | 75 | - "*[1][self::m:mn][not(contains(., $DecimalSeparators)) and text()<20] and" # NORWEGIAN: Changed decimal point to $DecimalSeparators |
|
122 | 116 | then: [x: "DefinitionValue(*[2], 'Speech', 'OrdinalFractionalDenominatorsForUnits')"] |
123 | 117 | else: [x: "*[2]", CT: "dels"] # this is wrong but shouldn't occur normally -- need to write a function to compute cardinal numbers as words |
124 | 118 |
|
125 | | -# audit-ignore |
126 | 119 | # Units (e.g., meters per second, m^2/s^2, (3m^2)/s) |
127 | 120 | # NORWEGIAN: Added rule for t="time" |
128 | | -- name: per-fraction |
| 121 | +- name: per-fraction # audit-ignore |
129 | 122 | tag: fraction |
130 | 123 | match: |
131 | 124 | - "BaseNode(*[1])[contains(@data-intent-property, ':unit') or" |
|
141 | 134 | else: |
142 | 135 | - x: "*[2]" |
143 | 136 |
|
144 | | -# audit-ignore |
145 | 137 | - name: simple |
146 | 138 | # don't include nested fractions. E.g, fraction a plus b over c + 1 end fraction" is ambiguous |
147 | 139 | # by simplistic SimpleSpeak's rules "b over c" is a fraction, but if we say nested fractions |
|
156 | 148 | - x: "*[2]" |
157 | 149 | - pause: short |
158 | 150 |
|
159 | | -# audit-ignore |
160 | | -- name: default |
| 151 | +- name: default # audit-ignore |
161 | 152 | tag: fraction |
162 | 153 | match: "." |
163 | 154 | replace: |
|
176 | 167 | - T: "slutt brøk" # phrase(start 7 over 8 'end of fraction') |
177 | 168 | - pause: medium |
178 | 169 |
|
179 | | -# audit-ignore |
180 | 170 | # rules for functions raised to a power |
181 | 171 | # these could have been written on 'mrow' but putting them on msup seems more specific |
182 | 172 | # to see if it is a function, we look right to see if the following sibling is apply-function |
|
187 | 177 | - T: "invers" # phrase(the 'inverse' of f) |
188 | 178 | - x: "*[1]" |
189 | 179 |
|
190 | | -# audit-ignore |
191 | 180 | - name: function-squared-or-cubed |
192 | 181 | tag: power |
193 | 182 | match: |
|
201 | 190 | then: [T: "i andre"] # phrase(5 'squared' equals 25) |
202 | 191 | else: [T: "i tredje"] # phrase(5 'cubed' equals 125) |
203 | 192 |
|
204 | | -# audit-ignore |
| 193 | +# The following element is invisible function application. Used for expressions like sin^n x. |
205 | 194 | - name: function-power |
206 | 195 | tag: power |
207 | 196 | match: |
|
213 | 202 | - x: "*[2]" |
214 | 203 | - pause: short |
215 | 204 |
|
216 | | -# audit-ignore |
217 | 205 | # non-function rules for power |
218 | 206 | - name: squared-or-cubed |
219 | 207 | tag: power |
|
226 | 214 | then: [T: "i andre"] # phrase(5 'squared' equals 25) |
227 | 215 | else: [T: "i tredje"] # phrase(5 'cubed' equals 125) |
228 | 216 |
|
229 | | -# audit-ignore |
230 | | -- name: simple-integer |
| 217 | +- name: simple-integer # audit-ignore |
231 | 218 | tag: power |
232 | 219 | match: "*[2][self::m:mn][not(contains(., $DecimalSeparators))]" # NORWEGIAN: Changed decimal point to $DecimalSeparators |
233 | 220 | replace: |
|
236 | 223 | - x: "*[2]" |
237 | 224 | - pause: short |
238 | 225 |
|
239 | | -# audit-ignore |
240 | | -- name: simple-negative-integer |
| 226 | +- name: simple-negative-integer # audit-ignore |
241 | 227 | tag: power |
242 | 228 | match: |
243 | 229 | - "*[2][self::m:minus and count(*)=1 and" |
|
248 | 234 | - x: "*[2]" |
249 | 235 | - pause: short |
250 | 236 |
|
251 | | -# audit-ignore |
252 | 237 | - name: simple-var |
253 | 238 | tag: power |
254 | 239 | match: "*[2][self::m:mi][string-length(.)=1]" |
|
258 | 243 | - x: "*[2]" |
259 | 244 | - pause: short |
260 | 245 |
|
261 | | -# audit-ignore |
262 | 246 | - name: simple |
263 | 247 | tag: power |
264 | 248 | match: "IsNode(*[2], 'leaf')" |
|
268 | 252 | - x: "*[2]" |
269 | 253 | - pause: short |
270 | 254 |
|
271 | | -# audit-ignore |
272 | | -- name: nested |
| 255 | +- name: nested # audit-ignore |
273 | 256 | # it won't end in "power" if the exponent is simple enough |
274 | 257 | # FIX: not that important, but this misses the case where the nested exp is a negative integer (change test if this is fixed) |
275 | 258 | # ending nested exponents with "...power power" sounds bad |
|
297 | 280 |
|
298 | 281 | # |
299 | 282 | # Some rules on mrows |
300 | | -# audit-ignore |
301 | | -- name: set |
| 283 | +- name: set # audit-ignore |
302 | 284 | tag: set |
303 | 285 | match: "." |
304 | 286 | replace: |
|
316 | 298 | - T: "mengden" # phrase(here is a 'set' of numbers) |
317 | 299 | - x: "*[1]" |
318 | 300 |
|
319 | | -# audit-ignore |
320 | 301 | # NORWEGIAN: Added sqrt, so it, for example, says "sqrt a times sqrt b" |
321 | 302 | - name: times |
322 | 303 | tag: mo |
|
346 | 327 | replace: |
347 | 328 | - T: "ganger" # phrase(7 'times' 5 equals 35) |
348 | 329 |
|
349 | | -# audit-ignore |
350 | 330 | - name: no-say-parens |
351 | 331 | tag: mrow |
352 | 332 | match: |
|
0 commit comments