1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
# Provide an overview/outline/description of the math
# MathPlayer just tried to shorten things like "mfrac" by just saying "fraction"
# For mrow, it say up to 5 operands and just say "and n more things" for the rest
# This results in strings of varying length. Given human memory is about 7 words long,
# it would be better to aim for 7 words (maybe aim for a range of 6-10 words).
# Idea:
# Start by generating a terse form of the speech
# At every step when the strings are being joined
# a) if the #words <= 7, return the joined string
# b) otherwise, set verbosity to 'overview' and regenerate the expression and use that
# There is a balance that you want to maximize the info given, so 10 words is likely better then 3.
# That might mean that at the top level, we may want to allow the first few children to expand
- name: overview-default
tag: mfrac
match: "."
replace:
- T: "pecahan"
- test:
if: "IsNode(*[1], 'simple') and IsNode(*[2], 'simple')"
then:
- x: "*[1]"
- T: "per"
- x: "*[2]"
- name: overview-default
tag: msqrt
match: "."
replace:
- T: "akar kuadrat"
- test:
if: "IsNode(*[1], 'simple')"
then:
- test:
if: "$Verbosity!='Terse'"
then:
- x: "*[1]"
- name: overview-default
tag: mroot
match: "."
replace:
- test:
if: "*[2][self::m:mn]"
then_test:
- if: "*[2][.='2']"
then:
- else_if: "*[2][.='3']"
then:
- else_if: "*[2][not(contains(., '.'))]"
then:
else:
- test:
if: "*[2][self::m:mi][string-length(.)=1]"
then:
- T: akar pangkat
- x: "*[2]"
- pronounce: # in Indonesian no need -th
# - pronounce: [text: "-th", ipa: "θ", sapi5: "th", eloquence: "T"]
else:
- test:
if: "IsNode(*[1], 'simple')"
then:
- test:
if: "$Verbosity!='Terse'"
then:
- x: "*[1]"
- name: matrix-override
tag: mrow
match:
- "*[2][self::m:mtable] and"
- "(IsBracketed(., '(', ')') or IsBracketed(., '[', ']') or IsBracketed(., '|', '|'))"
replace:
- test:
if: "*[1][.='|']" # just need to check the first bracket since we know it must be (, [, or |
then:
else:
- T: ""
- x: count(*[2]/*)
- T: kali
- x: count(*[2]/*[self::m:mtr][1]/*)
- name: overview-default
tag: mtable
match: "."
replace:
- T: "tabel"
- x: count(*[2]/*)
- T: kali
- x: count(*[2]/*[self::m:mtr][1]/*)
- T: ""
- name: short-mrow
tag: mrow
match: "count(*)<6"
replace:
- insert:
nodes: "*"
replace:
- name: long-mrow
tag: mrow
match: "."
replace:
- x: "*[1]"
- pause: auto
- x: "*[2]"
- pause: auto
- x: "*[3]"
- pause: auto
- x: "*[4]"
- pause: auto
- x: "*[5]"
- pause: auto
- T: "dan seterusnya"
- include: "SimpleSpeak_Rules.yaml"