具有 python 模式的 Aiml 不识别 DON'T 但识别 DO NOT

Aiml with python pattern doesn't recognise DON'T but recognise DO NOT

这按预期工作

    <category>
     <pattern>DO NOT CALL ME *</pattern>
     <that>WHAT CAN I CALL YOU</that>
     <template>So what can I call you?</template>
    </category>

这会抛出一个不匹配的错误

    <category>
      <pattern>DON'T CALL ME *</pattern>
      <that>WHAT CAN I CALL YOU</that>
      <template>So what can I call you?</template>
    </category>

我显然在做一些愚蠢的事情。有人知道吗?

您收到该错误是因为 ' 未转义,因此 Python 认为字符串到此结束。
尝试通过添加斜杠 \'.

来转义 '