DT article agreement when using "a/an" and removing words

Is there a way to ensure an article agrees with the adjacent word in a suggestion? For instance, suppose I have the following rule:

<rule id="MIRACULOUS_ESCAPE">
  <pattern>
    <token postag="DT"/>
    <token min="0" regexp="yes">very|truly|really|wildly</token>
    <token>miraculous</token>
    <token>escape</token>
  </pattern>
  <message>The phrase is a cliché.</message>
  <suggestion>\1 escape</suggestion>
  <example correction="an escape">It was <marker>a very miraculous escape</marker>.</example>
</rule>

The rule fails because the suggestion produces “a escape” not “an escape.”

My current workaround involves creating an exception for “a” in DT, then creating another rule that specifically addresses the “a” article as a token, but this does not seem like a best practice. Is there a better way that keeps the rule as one?

I appreciate you!

@Tyler,

You can use a rulegroup to keep 2 rules together. Give the rulegroup an ID and name and do not use an ID/name for the 2 rules in the rulegroup.

There is an undocumented postag +INDT that you can use to give the correct suggestion for a/an, but I cannot make it give the correct solution with your rule (which uses DT).

Aside: always use testrules to make sure that your rules are correct. Your rule is missing a name, and testrules fails.

Hi @Tyler!

I would make it a rulegroup, it is absolutely okay in this case.

This is how to use the +INDT postag:

<rulegroup id="MIRACULOUS_ESCAPE" name="a miraculous escape (an escape)" default="temp_off">
<rule><!-- DT = an? -->
  <pattern>
    <token postag="DT" regexp="yes">an?</token>
    <token min="0" regexp="yes">very|truly|really|wildly</token>
    <token>miraculous</token>
    <token>escape</token>
  </pattern>
  <message>The phrase is a cliché.</message>
  <suggestion><match no="4" postag="+INDT"/></suggestion>
  <example correction="an escape">It was <marker>a very miraculous escape</marker>.</example>
</rule>
<rule><!-- DT != an? -->
  <pattern>
    <token postag="DT"><exception regexp="yes">an?</exception></token>
    <token min="0" regexp="yes">very|truly|really|wildly</token>
    <token>miraculous</token>
    <token>escape</token>
  </pattern>
  <message>The phrase is a cliché.</message>
  <suggestion>\1 escape</suggestion>
  <example correction="the escape">This is <marker>the very miraculous escape</marker>.</example>
</rule>
</rulegroup>