Search code examples
python-2.7aiml

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


This works as expected

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

This throws an unmatched error

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

I am obviously doing something stupid. Anyone know what?


Solution

  • You are getting that error because ' is not escaped so Python thinks that the string ends there.
    try escaping the ' by adding a slash \'.