MathCAT
MathCAT copied to clipboard
Improve navigation.yaml to reduce repetition (especially for language-specific text)
There are a lot of navigation rules that are independent of speech. Many more can be made independent and also avoid repetition. E.g., there are 6 rules that have
- test:
- if: "$NavCommand = 'MoveNext'"
then: [{t: "move"}]
- else_if: "$NavCommand = 'ReadNext'"
then: [{t: "read"}]
else: [{t: "describe"}]
A new (language-specific) rule can be created and then these could defer to it by setting some env variable to trigger what to say/act as params. The rules containing the above can then be language independent. The language rules would -include
the base navigation rules.
Other than learning the trick to do this, this is a good first project rule.
An alternative idea is to add start
node in navigate.rs
before the call. In navigate.yaml
, match on that node and define a bunch of variables such as
- Left: "left"
- Right: "right"
- SayMove: "Next/Previous" # Write a rule to test this and it does the above block to say "move", "read", or "describe"
- IsNext: "$NavCommand = 'MoveNext' or "$NavCommand = 'ReadNext' or "$NavCommand = 'DescribeNext'"
- IsPrevious: ...
One can reference these variable to isolate language issues.
$IsNext
can save some repetition. Also, combining Next/Previous to a single command would help them stay in sync.