The pre element
Pre-processing substitutions apply directly to user questions. They are processed in the order they appear in the .cphrase
file. In the
simplest case they are just literal string replacements, although REGEXP-based substitutions can be specified.
For example, the following would transform the user question "I ate lax pasta twenty minutes ago
" to "add eating lax pasta twenty minutes ago
".
<pre from="I ate" to="add eating"/>
The following would transform the user question "Cheese with less than 20g fat
" to "Cheese with less than 20 grams fat
". It is using REGEXP registers.
<pre from="(\d+)g" to="\1 grams"/>
The DTD definition of pre
is:
<!ATTLIST pre from CDATA #REQUIRED to CDATA #REQUIRED alive CDATA #IMPLIED description CDATA #IMPLIED>
from specifies a pattern to be matched.
to specifies a pattern to be substituted in place of from.