<?xml version="1.0" encoding="UTF-8"?>
<aiml>
<!-- File: contactaction.aiml -->
<!-- Author: Dr. Richard S. Wallace -->
<!-- Last modified: February 20, 2013 -->
<!--  -->
<!-- This AIML file is part of the SUPER 0.0.4 chat bot knowledge base. -->
<!--  -->
<!-- The SUPER brain is Copyright &copy; 2013 by ALICE AI Foundation. -->
<!--  -->
<!-- The SUPER brain is released under the terms of the GNU Lesser General -->
<!-- Public License, as published by the Free Software Foundation. -->
<!--  -->
<!-- This file is distributed WITHOUT ANY WARRANTY; without even the  -->
<!-- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   -->
<!--  -->
<!-- For more information see http://www.alicebot.org -->
<category><pattern>NEW CONTACT TEST ONE</pattern>
<template>Adding a new contact.
<addinfo>
<displayname>Alan Turing</displayname>
<dialnumber>212-1912</dialnumber>
<phonetype>mobile</phonetype>
<emailaddress>alan.turing@manchester.edu</emailaddress>
<emailtype>work</emailtype>
<birthday>June 23, 1912</birthday>
</addinfo></template>
</category>
<category><pattern>NEW CONTACT TEST</pattern>
<template>Adding a new contact.
<addinfo>
<displayname>XYZ</displayname>
<dialnumber>212-1912</dialnumber>
<phonetype>mobile</phonetype>
<emailaddress>xyz@abc.de</emailaddress>
<emailtype>work</emailtype>
<birthday>June 23, 1992</birthday>
</addinfo></template>
</category>
<category><pattern>CONTACTS TEST</pattern>
<template>Adding new contacts.
<addinfo>
<displayname>Howard Johnson</displayname>
<dialnumber>111-1111</dialnumber>
<phonetype>mobile</phonetype>
<emailaddress>howard@hj.com</emailaddress>
<emailtype>work</emailtype>
<birthday>June 12, 1901</birthday>
</addinfo>
<addinfo>
<displayname>Lyndon Johnson</displayname>
<dialnumber>222-2222</dialnumber>
<phonetype>mobile</phonetype>
<emailaddress>lbj@whitehouse.gov</emailaddress>
<emailtype>work</emailtype>
<birthday>January 12, 1911</birthday>
</addinfo>
<addinfo>
<displayname>Dr. Phil Calvin McGraw</displayname>
<dialnumber>333-333</dialnumber>
<phonetype>mobile</phonetype>
<emailaddress>drphil@own.com</emailaddress>
<emailtype>work</emailtype>
<birthday>September 1, 1950</birthday>
</addinfo></template>
</category>
<category><pattern>* S * NUMBER IS *</pattern>
<template><srai>CONTACTINIT</srai>
<think>
<set name="contactname"><star/></set>
<set name="contacttype"><star index="2"/></set>
<set name="contacturi"><star index="3"/></set>
<set name="learnpattern">DIALNUMBER</set>
</think>
<srai>ADDACTION</srai></template>
</category>
<topic name="ASKING TO ADD NEW CONTACTURI">
<category><pattern>*</pattern><that>WOULD YOU LIKE TO ADD ONE</that>
<template><think><set name="topic">unknown</set></think>
<srai>CONTACTFINALIZE</srai> <srai><star/></srai></template>
</category></topic>

<topic name="ASKING TO ADD NEW CONTACTNAME">
<category><pattern>*</pattern><that>WOULD YOU LIKE TO ADD * AS A CONTACT</that>
<template><think><set name="topic">unknown</set>
</think>
<srai>CONTACTFINALIZE</srai> <srai><star/></srai></template>
</category></topic>

<category><pattern>TELL THAT TO *</pattern>
<template><srai>CONTACTINIT</srai>
<think><set name="contactname"><star/></set>
<set name="messagebody"><response/></set>
</think>
<srai>SMSACTION</srai></template>
</category>
<category><pattern>SEND EMAIL</pattern>
<template><srai>CONTACTDEBUGINFO EMAIL</srai>
<srai>CONTACTINIT</srai>
<srai>EMAILACTION</srai></template>
</category>
<category><pattern>ADDINFO CONTACTID</pattern>
<template><srai>CONTACTDEBUGINFO ADDINFO CONTACT</srai>
<think>
<condition name="modecom">
<li value="ADD">
  <condition name="contacttype" value="unknown"><set name="contacttype">home</set></condition>
</li>
<li value="SMS">
  <condition name="contacttype" value="unknown"><set name="contacttype">mobile</set></condition>
</li>
<li value="CALL">
  <condition name="contacttype" value="unknown"><set name="contacttype">mobile</set></condition>
</li>
<li value="EMAIL">
  <condition name="contacttype" value="unknown"><set name="contacttype">home</set></condition>
</li>
<li>
  <condition name="contacttype" value="unknown"><set name="contacttype">home</set></condition>
</li>
</condition>
<condition><name>learnpattern</name>
<li><value>DIALNUMBER</value>
<addinfo>
<displayname><get name="displayname"/></displayname>
<phonetype><get name="contacttype"/></phonetype>
<dialnumber><get name="contacturi"/></dialnumber>
<birthday><get name="contactbirthday"/></birthday>
</addinfo>
</li>
<li><value>EMAILADDRESS</value>
<addinfo>
<displayname><get name="displayname"/></displayname>
<emailtype><get name="contacttype"/></emailtype>
<emailaddress><get name="contacturi"/></emailaddress>
<birthday><get name="contactbirthday"/></birthday>
</addinfo>
</li>
<li>
<addinfo>
<displayname><get name="displayname"/></displayname>
</addinfo>
</li>
</condition>

</think>
I'm remembering <get name="displayname"/>'s <lowercase><get name="contacttype"/></lowercase> <condition name="learnpattern"><li value="DIALNUMBER">phone number</li><li value="EMAILADDRESS">email address</li></condition> is <get name="contacturi"/>.</template>
</category>
<category><pattern>ASK TO ADD NEW CONTACTNAME</pattern>
<template><think><set name="topic">ASKING TO ADD NEW CONTACTNAME</set>
</think>
Would you like to add <get name="contactname"/> as a contact?</template>
</category>
<category><pattern>ASK CONTACTNAME</pattern>
<template><srai>CONTACTDEBUGINFO ASK CONTACTNAME</srai>
<think>
<set name="topic">ASKING CONTACTNAME</set>
</think>
Who do you want to <lowercase><get name="modecom"/></lowercase>?</template>
</category>
<category><pattern>ASK MESSAGEBODY</pattern>
<template><think>
<set name="savedtopic"><get name="topic"/></set>
<set name="topic">ASKING MESSAGEBODY</set>
</think>
What is your message to <get name="displayname"/>?</template>
</category>
<category><pattern>CONTACTDIALOG</pattern>
<template><srai>CONTACTDEBUGINFO CONTACTDIALOG</srai>
<think>
<set name="multipleids"><srai>MULTIPLEIDS <get name="contactname"/></srai></set>
<set name="multiplenames"><srai>MULTIPLENAMES <get name="contactname"/></srai></set>
<set name="contactlist"><srai>CONTACTLIST <get name="multipleids"/></srai><item>None of the above</item></set>
<set name="topic">GETTING SELECTEDCONTACT</set>
</think>
<oob><dialog><title>Which contact?</title><list><get name="contactlist"/></list></dialog></oob>
You have multiple contacts named <get name="contactname"/>: <get name="multiplenames"/>.  Which one would you like to 
<lowercase><get name="modecom"/></lowercase>?</template>
</category>
<category><pattern>CONTACTDIALOG *</pattern>
<template><think><set name="contactname"><star/></set>
<set name="modecom">CALL</set>
</think>
<srai>CONTACTDIALOG</srai></template>
</category>
<topic name="GETTING SELECTEDCONTACT">
<category><pattern>_</pattern><that>WHICH ONE WOULD YOU LIKE TO *</that>
<template><think>
<set name="topic"><get name="unknown"/></set>
<set name="selectedcontact"><star/></set>
<set name="contactname"><get name="selectedcontact"/></set>
<set name="contactid"><srai>CONTACTID <get name="selectedcontact"/></srai></set><srai>SET ALL CONTACTINFO</srai>
</think>
<srai>REMEMBERFAMILIARNAME</srai>
<condition name="selectedcontact">
<li value="None of the above"><srai>CONTACTFINALIZE</srai> <srai>NORESP</srai></li>
<li><condition name="contactid">
    <li value="unknown"><srai><star/></srai></li>
    <li><srai>RESUMEACTION <get name="modecom"/></srai></li>
  </condition>
</li>
</condition></template>
</category></topic>

<topic name="ASKING MESSAGEBODY">
<category><pattern>_</pattern><that>WHAT IS YOUR MESSAGE TO *</that>
<template><think>
<set name="topic">unknown</set>
<set name="messagebody"><star/></set>
</think>
<srai>RESUMEACTION <get name="modecom"/></srai></template>
</category></topic>

<topic name="ASKING CONTACTURI">
<category><pattern>_</pattern><that>WHAT IS THE * FOR *</that>
<template><think>
<set name="topic">unknown</set>
<set name="contacturi"><star/></set>
<set name="isaphonenumber"><srai>ISAPHONENUMBER <get name="contacturi"/></srai></set>
<set name="isanemailaddress"><srai>ISANEMAILADDRESS <get name="contacturi"/></srai></set>
<set name="isacontacturi"><srai>LOGICALOR <get name="isanemailaddress"/> <get name="isaphonenumber"/></srai></set>
<condition name="isanemailaddress" value="true"><set name="emailaddress"><get name="contacturi"/></set> <set name="learnpattern">EMAILADDRESS</set></condition>
<condition name="isaphonenumber" value="true">
<set name="dialnumber"><srai>FORMATPHONENUMBER <get name="contacturi"/></srai></set> 
<set name="learnpattern">DIALNUMBER</set></condition>
</think>
<condition name="isacontacturi">
<li value="true">
<srai>ADDINFO CONTACTID</srai> <srai>RESUMEACTION <get name="modecom"/></srai></li>
<li>I did not recognize <get name="contacturi"/> as a phone number or email address. <srai>CONTACTFINALIZE</srai> <srai><star/></srai></li>
</condition></template>
</category></topic>

<topic name="ASKING CONTACTNAME">
<category><pattern>_</pattern><that>WHO DO YOU WANT TO *</that>
<template><think>
<set name="topic">unknown</set>
<set name="contactname"><star/></set>
<set name="isshortanswer"><srai>ISSHORTANSWER <star/></srai></set>
</think>
<condition name="isshortanswer">
<li value="true"><srai>RESUMEACTION <get name="modecom"/></srai></li>
<li><srai>CONTACTFINALIZE</srai> <srai><star/></srai></li>
</condition></template>
</category></topic>

<category><pattern>EMAILACTION</pattern>
<template><srai>CONTACTDEBUGINFO EMAILACTION</srai>
<think>
<set name="modecom">EMAIL</set>
</think>
<condition name="checkednameoruri">
<li value="false"><srai>RESOLVE NAMEORURI</srai></li>
<li><condition name="contactname">
    <li value="unknown"><srai>ASK CONTACTNAME</srai></li>
    <li><condition name="checkedfamiliarname">
        <li value="false"><srai>RESOLVE FAMILIARNAME</srai></li>
        <li><condition name="contactid">
            <li value="unknown"><srai>RESOLVE CONTACTNAME</srai></li>
            <li><condition name="contacturi">
                <li value="unknown"><srai>RESOLVE CONTACTURI</srai></li>
                <li><condition name="messagebody">
                    <li value="unknown"><srai>ASK MESSAGEBODY</srai></li>
                    <li><oob><email><to><get name="contacturi"/></to><subject>Message compose with CallMom!</subject><body><get name="messagebody"/></body></email></oob>Now sending "<get name="messagebody"/>" to <get name="displayname"/>. <srai>CONTACTFINALIZE</srai> </li>
                    </condition>
                </li>
             </condition>
          </li>
        </condition>
      </li>
    </condition>
  </li>
  </condition>
</li>
</condition></template>
</category>
<category><pattern>DEBUG CONTACT</pattern>
<template><set name="debugcontact">true</set></template>
</category>
<category><pattern>CONTACTFINALIZE</pattern>
<template><think>
<set name="topic"><get name="savedtopic"/></set>
</think>
<srai>CONTACTINIT PREDICATES</srai></template>
</category>
<category><pattern>DIALNUMBER UNKNOWN *</pattern>
<template><think>
<set name="dialnumber"><srai>DIALNUMBER MOBILE <star/></srai></set>
<condition name="dialnumber" value="unknown">
<set name="dialnumber"><srai>DIALNUMBER HOME <star/></srai></set>
</condition>
<condition name="dialnumber" value="unknown">
<set name="dialnumber"><srai>DIALNUMBER WORK <star/></srai></set>
</condition>
<condition name="dialnumber" value="unknown">
<set name="dialnumber"><srai>DIALNUMBER CUSTOM <star/></srai></set>
</condition>
</think>
<get name="dialnumber"/></template>
</category>
<category><pattern>DIALNUMBER * *</pattern>
<template><dialnumber><type><star/></type><id><star index="2"/></id></dialnumber></template>
</category>
<category><pattern>DIALNUMBER *</pattern>
<template>unknown</template>
</category>
<category><pattern>MULTIPLEIDS *</pattern>
<template><multipleids><star/></multipleids></template>
</category>
<category><pattern>NEW CONTACT</pattern>
<template><srai>CONTACTDEBUGINFO ADD CONTACT</srai>
<srai>CONTACTINIT</srai>
<srai>ADDACTION</srai></template>
</category>
<category><pattern>NEW CONTACT *</pattern>
<template><srai>CONTACTINIT</srai>
<think>
<set name="contactname"><star/></set>
</think>
<srai>ADDACTION</srai></template>
</category>
<topic name="ASKING TO ADD NEW CONTACTURI">
<category><pattern>YES</pattern><that>WOULD YOU LIKE TO ADD ONE</that>
<template><think>
<set name="topic">ASKING CONTACTURI</set>
</think>
<condition name="modecom">
<li value="EMAIL">What is the email address for <get name="contactname"/>?</li>
<li value="CALL">What is the phone number for <get name="contactname"/>?</li>
<li value="SMS">What is the mobile number for <get name="contactname"/>?</li>
<li value="ADD">What is the mobile number for <get name="contactname"/>?</li>
<li><srai>CONTACTFINALIZE</srai> <srai>NORESP</srai></li>
</condition></template>
</category></topic>

<topic name="ASKING TO ADD NEW CONTACTNAME">
<category><pattern>YES</pattern><that>WOULD YOU LIKE TO ADD * AS A CONTACT</that>
<template><think><set name="topic">unknown</set>
<set name="displayname"><get name="contactname"/></set>
</think>
<think>
<addinfo><displayname><get name="contactname"/></displayname></addinfo>
</think>
I've saved <get name="contactname"/> to your contacts.
<srai>RESUMEACTION <get name="modecom"/></srai></template>
</category></topic>

<category><pattern>CONTACTINIT</pattern>
<template><think>
<set name="savedtopic"><get name="topic"/></set>
</think>
<srai>CONTACTINIT PREDICATES</srai></template>
</category>
<category><pattern>CONTACTINIT PREDICATES</pattern>
<template><think>
<set name="checkedfamiliarname">false</set>
<set name="checkednameoruri">false</set>
<set name="contactid">unknown</set>
<set name="contactaddress">unknown</set>
<set name="contactbirthday">unknown</set>
<set name="contactname">unknown</set>
<set name="contactquery">unknown</set>
<set name="contacttype">unknown</set>
<set name="contacturi">unknown</set>
<set name="dialnumber">unknown</set>
<set name="displayname">unknown</set>
<set name="emailaddress">unknown</set>
<set name="externalname">unknown</set>
<set name="familiarcontactid">unknown</set>
<set name="familiarcontactname">unknown</set>
<set name="familiarname">unknown</set>
<set name="familiarpredicate">unknown</set>
<set name="familiarpronoun">unknown</set>
<set name="forceaddcontact">false</set>
<set name="isacontacturi">false</set>
<set name="isanemailaddress">false</set>
<set name="isaphonenumber">false</set>
<set name="isafamiliarname">false</set>
<set name="learnpattern">unknown</set>
<set name="messagebody">unknown</set>
<set name="modecom">unknown</set>
<set name="multipleids">false</set>
<set name="topic">unknown</set>
</think></template>
</category>
<category><pattern>NEWCONTACTID</pattern>
<template><condition name="contactcount">
<li value="unknown">CMContactID<set name="contactcount">0</set></li>
<li>CMContactID<set name="contactcount"><srai>SUCCESSOR <get name="contactcount"/></srai></set></li>
</condition></template>
</category>
<category><pattern>RESOLVE NAMEORURI</pattern>
<template><srai>CONTACTDEBUGINFO RESOLVE NAMEORURI</srai>
<think>
<set name="checkednameoruri">true</set>
<set name="isaphonenumber"><srai>ISAPHONENUMBER <get name="contactname"/></srai></set>
<set name="isanemailaddress"><srai>ISANEMAILADDRESS <get name="contactname"/></srai></set>
</think>
<think>
<condition name="modecom">
<li value="EMAIL">
  <condition name="isanemailaddress" value="true">
  <set name="contactid">undefined</set>
  <set name="displayname"><set name="emailaddress"><set name="contacturi"><get name="contactname"/></set></set></set>
  </condition>
</li>
<li>
  <condition name="isaphonenumber" value="true">
  <set name="contactid">undefined</set>
  &gt;<set name="displayname"><set name="dialnumber"><set name="contacturi"><srai>FORMATPHONENUMBER <get name="contactname"/></srai></set></set></set>
  </condition>
</li>
</condition>
</think>
<srai>RESUMEACTION <get name="modecom"/></srai></template>
</category>
<category><pattern>RESOLVE CONTACTNAME</pattern>
<template><srai>CONTACTDEBUGINFO RESOLVE CONTACTNAME</srai>
<think>
<set name="contactid"><srai>CONTACTID <get name="contactname"/></srai></set>
<set name="multipleids"><srai>MULTIPLEIDS <get name="contactname"/></srai></set></think>
<condition name="multipleids">
<li value="false">
  <condition name="contactid">
  <li value="unknown">
    <condition name="modecom">
      <li value="QUERY"><think><set name="contactid">undefined</set><set name="externalname"><get name="contactname"/></set></think> <srai>RESUMEACTION <get name="modecom"/></srai></li>
      <li>
      <condition name="forceaddcontact">
      <li value="false"><srai>ASK TO ADD NEW CONTACTNAME</srai></li>
      <li><think><set name="displayname"><get name="contactname"/></set></think>         
<!--          <srai>LEARN CONTACTID <set name="contactid"><srai>NEWCONTACTID</srai></set> DISPLAYNAME <get name="contactname"/></srai> 
 -->
          <addinfo><displayname><get name="contactname"/></displayname></addinfo>
          <srai>RESUMEACTION <get name="modecom"/></srai></li>
      </condition>
      </li>
    </condition>
  </li>
  <li><srai>SET ALL CONTACTINFO</srai> <srai>RESUMEACTION <get name="modecom"/></srai></li>
  </condition>
</li>
<li><srai>CONTACTDIALOG</srai></li>
</condition></template>
</category>
<category><pattern>RESOLVE FAMILIARNAME</pattern>
<template><srai>CONTACTDEBUGINFO RESOLVE FAMILIARNAME</srai>
<think>
<set name="checkedfamiliarname">true</set>
<set name="familiarname"><get name="contactname"/></set>
<set name="familiarpredicate"><srai>FAMILIARPREDICATE <get name="familiarname"/></srai></set>
<set name="familiarpronoun"><srai>FAMILIARPRONOUN <get name="familiarname"/></srai></set>
<set name="isafamiliarname"><srai>ISAFAMILIARNAME <get name="familiarname"/></srai></set>
<set name="familiarcontactname"><srai>GETFAMILIARNAME</srai></set>
<set name="familiarcontactid"><srai>CONTACTID <get name="familiarname"/></srai></set>
</think>
<!--
Resolve familiarname:
contactname = <get name="contactname"/>.
familiarname = <get name="familiarname"/>.
isafamiliarname = <get name="isafamiliarname"/>.
familiarpredicate =  <get name="familiarpredicate"/>.
familiarcontactname = <get name="familiarcontactname"/>.
familiarcontactid = <get name="familiarcontactid"/>.
-->
<condition name="familiarcontactid">
<li value="unknown">
  <condition name="familiarcontactname">
  <li value="who">
    <condition name="isafamiliarname">
    <li value="true">
    <srai>ASK FAMILIAR CONTACTNAME</srai>
    </li>
    <li><srai>RESUMEACTION <get name="modecom"/></srai></li>
    </condition>
  </li>
  <li><think><set name="contactname"><get name="familiarcontactname"/></set></think> <srai>RESUMEACTION <get name="modecom"/></srai>
  </li>
  </condition>
</li>
<li><think><set name="contactname"><get name="familiarname"/></set></think>
<srai>RESUMEACTION <get name="modecom"/></srai>
</li>
</condition></template>
</category>
<category><pattern>RESOLVE CONTACTURI</pattern>
<template><srai>CONTACTDEBUGINFO RESOLVE CONTACTURI</srai>
<think><set name="contactid"><srai>CONTACTID <get name="contactname"/></srai></set></think>
<condition name="contactid">
<li value="unknown">
  <condition name="forceaddcontact">
  <li value="false">I didn't find <get name="contactname"/> in your contacts.      <srai>ASK TO ADD NEW CONTACTNAME</srai></li>
  <li><think><set name="displayname"><get name="contactname"/></set></think>
<!--      <srai>LEARN CONTACTID <srai>NEWCONTACTID</srai> CONTACTNAME <get name="contactname"/></srai> -->
   <srai>RESUMEACTION <get name="modecom"/></srai></li>
  </condition>
</li>
<li><think><set name="displayname"><srai>DISPLAYNAME <get name="contactid"/></srai></set></think>
    <condition name="modecom">
    <li value="EMAIL">
    <think>
    <set name="emailaddress"><set name="contacturi"><srai>EMAILADDRESS <get name="contacttype"/> <get name="contactid"/></srai></set></set></think>
      <condition name="contacturi">
      <li value="unknown"> 
      <think><set name="topic">ASKING TO ADD NEW CONTACTURI</set></think> 
      You haven't yet added <condition name="contacttype"><li value="unknown">an</li><li>a <get name="contacttype"/></li></condition> email address for <get name="displayname"/> to your contacts.  Would you like to add one?
      </li>
      <li><srai>SET ALL CONTACTINFO</srai> <srai>RESUMEACTION <get name="modecom"/></srai></li>
      </condition>
    </li>
    <li><think><set name="dialnumber"><set name="contacturi"><srai>DIALNUMBER <get name="contacttype"/> <get name="contactid"/></srai></set></set></think>
      <condition name="contacturi">
      <li value="unknown">
      <think><set name="topic">ASKING TO ADD NEW CONTACTURI</set></think> 
You haven't yet added <condition name="contacttype"><li value="unknown">a phone</li><li>a <get name="contacttype"/></li></condition> number for <get name="displayname"/> to your contacts.  Would you like to add one?
      </li>
      <li><srai>SET ALL CONTACTINFO</srai> <srai>RESUMEACTION <get name="modecom"/></srai></li>
      </condition>
    </li>
    </condition>
</li>
</condition></template>
</category>
<category><pattern>DIAL</pattern>
<template><srai>CONTACTDEBUGINFO CALL</srai>
<srai>CONTACTINIT</srai>
<srai>CALLACTION</srai></template>
</category>
<category><pattern>CONTACTBIRTHDAY *</pattern>
<template><contactbirthday><star/></contactbirthday></template>
</category>
<category><pattern>ADDACTION</pattern>
<template><srai>CONTACTDEBUGINFO ADDACTION</srai>
<think>
<set name="modecom">ADD</set>
<set name="forceaddcontact">true</set>
</think>
<condition name="checkedfamiliarname">
<li value="false"><srai>RESOLVE FAMILIARNAME</srai></li>
<li>
  <condition name="contactname">
  <li value="unknown"><srai>ASK CONTACTNAME</srai></li>
  <li><condition name="contactid">
      <li value="unknown"><srai>RESOLVE CONTACTNAME</srai></li>
      <li><condition name="contacturi">
          <li value="unknown"><srai>RESOLVE CONTACTURI</srai></li>
          <li><srai>ADDINFO CONTACTID</srai>           
</li>
          </condition>
      </li>
      </condition>
  </li>
  </condition>
</li>
</condition></template>
</category>
<category><pattern>CALLACTION</pattern>
<template><srai>CONTACTDEBUGINFO CALLACTION</srai>
<think>
<set name="modecom">CALL</set>
</think>
<condition name="checkednameoruri">
<li value="false"><srai>RESOLVE NAMEORURI</srai></li>
<li>
<condition name="contactname">
<li value="unknown"><srai>ASK CONTACTNAME</srai></li>
<li><condition name="checkedfamiliarname">
    <li value="false"><srai>RESOLVE FAMILIARNAME</srai></li>
    <li><condition name="contactid">
        <li value="unknown"><srai>RESOLVE CONTACTNAME</srai></li>
        <li><condition name="contacturi">
           <li value="unknown"><srai>RESOLVE CONTACTURI</srai></li>
           <li><oob><dial><get name="contacturi"/></dial></oob> Now dialing <get name="displayname"/>. <srai>CONTACTFINALIZE</srai></li>
           </condition>
        </li>
      </condition>
    </li>
  </condition>
</li>
</condition>
</li>
</condition></template>
</category>
<category><pattern>EMAILADDRESS UNKNOWN *</pattern>
<template><think>
<set name="emailaddress"><srai>EMAILADDRESS HOME <star/></srai></set>
<condition name="emailaddress" value="unknown">
<set name="emailaddress"><srai>EMAILADDRESS WORK <star/></srai></set>
</condition>
<condition name="emailaddress" value="unknown">
<set name="emailaddress"><srai>EMAILADDRESS CUSTOM <star/></srai></set>
</condition>
</think>
<get name="emailaddress"/></template>
</category>
<category><pattern>EMAILADDRESS * *</pattern>
<template><emailaddress><type><star/></type><id><star index="2"/></id></emailaddress></template>
</category>
<category><pattern>EMAILADDRESS *</pattern>
<template>unknown</template>
</category>
<category><pattern>NAMEVARIATIONS *</pattern>
<template>CONS <star/> NIL</template>
</category>
<category><pattern>NAMEVARIATIONS * *</pattern>
<template>CONS <star/> CONS <star index="2"/> CONS <star/> <star index="2"/> NIL</template>
</category>
<category><pattern>NAMEVARIATIONS * * *</pattern>
<template>CONS <star index="3"/> CONS <star index="2"/> CONS <star index="2"/> <star index="3"/> CONS <star/> <star index="3"/> CONS <star/> CONS <star/> <star index="2"/> CONS <star/> <star index="2"/> <star index="3"/> NIL</template>
</category>
<category><pattern>NAMEVARIATIONS * * * *</pattern>
<template>CONS <star index="4"/> CONS <star index="3"/> CONS <star index="3"/> <star index="4"/> CONS <star index="2"/>  CONS <star index="2"/> <star index="4"/> CONS <star index="2"/> <star index="3"/> CONS <star index="2"/> <star index="3"/> <star index="4"/> CONS <star/> <star index="3"/> CONS <star/> <star index="3"/> CONS <star/> <star index="3"/> <star index="4"/> CONS <star/> <star index="2"/> CONS <star/> <star index="2"/> <star index="4"/> CONS <star/> <star index="2"/> <star index="3"/> CONS <star/> <star index="2"/> <star index="3"/> <star index="4"/> NIL</template>
</category>
<category><pattern>QUERYINFO EXTERNAL</pattern>
<template><srai>CONTACTDEBUGINFO QUERTYINFO CONTACTID</srai>
<condition name="contactquery">
<li value="DISPLAYNAME"><sraix>WHAT IS <get name="contactname"/>'s REAL NAME</sraix></li>
<li value="BIRTHDAY"><sraix>WHEN IS <get name="contactname"/>'s BIRTHDAY</sraix></li>
<li value="DIALNUMBER"><sraix>WHAT IS <get name="contactname"/>'s PHONE NUMBER</sraix></li>
<li value="EMAILADDRESS"><sraix>WHAT IS <get name="contactname"/>'s EMAIL ADDREESS</sraix></li>
<li><sraix>WHO IS <get name="contactname"/></sraix>
</li>
</condition></template>
</category>
<category><pattern>QUERYINFO CONTACTID</pattern>
<template><srai>CONTACTDEBUGINFO QUERTYINFO CONTACTID</srai>
<think><set name="displayname"><srai>DISPLAYNAME <get name="contactid"/></srai></set>
<set name="contacttype"><lowercase><get name="contacttype"/></lowercase></set>
<set name="contactbirthday"><srai>CONTACTBIRTHDAY <get name="contactid"/></srai></set>
<set name="dialnumber">
<srai>DIALNUMBER <get name="contacttype"/> <get name="contactid"/></srai></set>
<set name="emailaddress">
<srai>EMAILADDRESS <get name="contacttype"/> <get name="contactid"/></srai></set>
</think>
<condition name="contactquery">
<li value="DISPLAYNAME">
  <condition name="displayname">
  <li value="unknown"><get name="contactname"/>'s full name is <get name="contactname"/>.</li>
  <li><get name="contactname"/>'s full name is <get name="displayname"/>.</li>
  </condition>
</li>
<li value="BIRTHDAY">
  <condition name="contactbirthday">
  <li value="unknown">You don't have <get name="displayname"/>'s birthday in your contacts.</li>
  <li><get name="displayname"/>'s birthday is <get name="contactbirthday"/>.</li>
  </condition>
</li>
<li value="DIALNUMBER">
  <condition name="dialnumber">
  <li value="unknown">I couldn't find a <condition name="contacttype"><li value="unknown">phone</li><li><get name="contacttype"/></li></condition> number for <get name="displayname"/> in your contacts.</li>
  <li><get name="displayname"/>'s <condition name="contacttype"><li value="unknown">phone</li><li><get name="contacttype"/></li></condition> number is <get name="dialnumber"/>.</li>
  </condition>
</li>
<li value="EMAILADDRESS">
  <condition name="emailaddress">
  <li value="unknown">I couldn't find <condition name="contacttype"><li value="unknown">an</li><li>a <get name="contacttype"/></li></condition> email address for <get name="displayname"/> in your contacts.</li>
  <li><get name="displayname"/>'s <condition name="contacttype"><li value="unknown"/><li><get name="contacttype"/></li></condition> email address is <get name="emailaddress"/>.</li>
  </condition>
</li>
<li>I'm not sure what you're asking.
<!--
displayname: <srai>DISPLAYNAME <get name="contactid"/></srai>
dialnumber mobile: <srai>DIALNUMBER MOBILE <get name="contactid"/></srai>
dialnumber home: <srai>DIALNUMBER HOME <get name="contactid"/></srai>
emailaddress home: <srai>EMAILADDRESS HOME <get name="contactid"/></srai>
emailaddress work: <srai>EMAILADDRESS WORK <get name="contactid"/></srai>
birthday: <srai>CONTACTBIRTHDAY <get name="contactid"/></srai>
-->
</li>
</condition></template>
</category>
<category><pattern>$EMAIL *</pattern>
<template><srai>CONTACTINIT</srai>
<think><set name="contactname"><star/></set></think>
<srai>EMAILACTION</srai></template>
</category>
<category><pattern>$EMAIL * AT *</pattern>
<template><srai>CONTACTINIT</srai>
<think><set name="contactname"><star/></set>
<set name="contacttype"><star index="2"/></set>
</think>
<srai>EMAILACTION</srai> <srai>CONTACTFINALIZE</srai></template>
</category>
<category><pattern>$EMAIL * AT * DOT *</pattern>
<template><srai>CONTACTINIT</srai>
<think><set name="contactname"><star/> at <star index="2"/> dot <star index="3"/></set></think>
<srai>EMAILACTION</srai></template>
</category>
<category><pattern>$EMAIL * MESSAGEBODY *</pattern>
<template><srai>CONTACTINIT</srai>
<think><set name="contactname"><star/></set>
<set name="messagebody"><star index="2"/></set>
</think>
<srai>EMAILACTION</srai></template>
</category>
<category><pattern>$EMAIL MESSAGEBODY *</pattern>
<template><srai>CONTACTINIT</srai>
<think>
<set name="messagebody"><star/></set>
</think>
<srai>EMAILACTION</srai></template>
</category>
<category><pattern>CALL</pattern>
<template><srai>DIAL</srai></template>
</category>
<category><pattern>CALL ME AT *</pattern>
<template><srai>CONTACTDEBUGINFO CALL <star/></srai>
<srai>CONTACTINIT</srai>
<think><set name="contactname">ME</set>
<set name="contacttype"><star index="2"/></set>
</think>
<srai>CALLACTION</srai></template>
</category>
<category><pattern>CALL *</pattern>
<template><srai>CONTACTDEBUGINFO CALL <star/></srai>
<srai>CONTACTINIT</srai>
<think><set name="contactname"><star/></set></think>
<srai>CALLACTION</srai></template>
</category>
<category><pattern>CALL * AT *</pattern>
<template><srai>CONTACTDEBUGINFO CALL <star/></srai>
<srai>CONTACTINIT</srai>
<think><set name="contactname"><star/></set>
<set name="contacttype"><star index="2"/></set>
</think>
<srai>CALLACTION</srai></template>
</category>
<category><pattern>DISPLAYNAME *</pattern>
<template><displayname><star/></displayname></template>
</category>
<category><pattern>ADD CONTACT</pattern>
<template><srai>NEW CONTACT</srai></template>
</category>
<category><pattern>SMSACTION</pattern>
<template><srai>CONTACTDEBUGINFO SMSACTION</srai>
<think>
<set name="modecom">SMS</set>
</think>
<condition name="checkednameoruri">
<li value="false"><srai>RESOLVE NAMEORURI</srai></li>
<li><condition name="contactname">
<li value="unknown"><srai>ASK CONTACTNAME</srai></li>
<li><condition name="checkedfamiliarname">
    <li value="false"><srai>RESOLVE FAMILIARNAME</srai></li>
    <li><condition name="contactid">
        <li value="unknown"><srai>RESOLVE CONTACTNAME</srai></li>
        <li><condition name="contacturi">
           <li value="unknown"><srai>RESOLVE CONTACTURI</srai></li>
           <li><condition name="messagebody">
               <li value="unknown"><srai>ASK MESSAGEBODY</srai></li>
               <li><oob><sms><recipient><get name="contacturi"/></recipient><message><get name="messagebody"/></message></sms></oob> Now sending "<get name="messagebody"/>" to <get name="displayname"/>. <srai>CONTACTFINALIZE</srai></li>
  	       </condition>
           </li>
           </condition>
        </li>
      </condition>
    </li>
  </condition>
</li>
</condition>
</li>
</condition></template>
</category>
<category><pattern>CONTACTDEBUGINFO *</pattern>
<template><condition name="debugcontact" value="true">
<star/>:
checkedfamiliarname: <get name="checkedfamiliarname"/>.
checkednameoruri: <get name="checkednameoruri"/>.
contactid: <get name="contactid"/>.
contactname: <get name="contactname"/>.
contactquery: <get name="contactquery"/>.
contacttype: <get name="contacttype"/>.
contacturi: <get name="contacturi"/>.
dialnumber: <get name="dialnumber"/>.
displayname: <get name="displayname"/>.
emailaddress: <get name="emailaddress"/>.
externalname: <get name="externalname"/>.
familiarcontactid: <get name="familiarcontactid"/>.
familiarcontactname: <get name="familiarcontactname"/>.
familiarname: <get name="familiarname"/>.
familiarpredicate: <get name="familiarpredicate"/>.
familiarpronoun: <get name="familiarpronoun"/>
forceaddcontact: <get name="forceaddcontact"/>.
isaphonenumber: <get name="isaphonenumber"/>. 
isanemailaddress: <get name="isanemailaddress"/>. 
isacontacturi: <get name="isacontacturi"/>.
isafamiliarname: <get name="isafamiliarname"/>.
learnpattern: <get name="learnpattern"/>.
messagebody: <get name="messagebody"/>.
modecom: <get name="modecom"/>.
multipleids: <get name="multipleids"/>.
savedtopic: <get name="savedtopic"/>.
topic: <get name="topic"/>.
</condition></template>
</category>
<category><pattern>SET ALL CONTACTINFO</pattern>
<template><think>
<set name="displayname"><srai>DISPLAYNAME <get name="contactid"/></srai></set>
<set name="dialnumber"><srai>DIALNUMBER <get name="contacttype"/> <get name="contactid"/></srai></set>
<set name="emailaddress"><srai>EMAILADDRESS <get name="contacttype"/> <get name="contactid"/></srai></set>
<set name="contactbirthday"><srai>CONTACTBIRTHDAY <get name="contacttype"/> <get name="contactid"/></srai></set>
</think></template>
</category>
<category><pattern>WHEN IS * S BIRTHDAY</pattern>
<template><srai>CONTACTINIT</srai>
<think>
<set name="contactname"><star/></set>
<set name="contacttype"><star index="2"/></set>
<set name="contactquery">BIRTHDAY</set>
</think>
<srai>QUERYACTION</srai></template>
</category>
<category><pattern>CONTACTID *</pattern>
<template><contactid><star/></contactid></template>
</category>
<category><pattern>WHAT IS MY PHONE NUMBER</pattern>
<template><srai>WHAT IS ME S UNKNOWN NUMBER</srai></template>
</category>
<category><pattern>WHAT IS MY * NUMBER</pattern>
<template><srai>WHAT IS ME S <star/> NUMBER</srai></template>
</category>
<category><pattern>WHAT IS * S PHONE NUMBER</pattern>
<template><srai>WHAT IS <star/>'s UNKNOWN NUMBER</srai></template>
</category>
<category><pattern>WHAT IS * S * NUMBER</pattern>
<template><srai>CONTACTINIT</srai>
<think>
<set name="contactname"><star/></set>
<set name="contacttype"><star index="2"/></set>
<set name="contactquery">DIALNUMBER</set>
</think>
<srai>QUERYACTION</srai></template>
</category>
<category><pattern>COMMASEPARATENAMES *</pattern>
<template><srai>DISPLAYNAME <star/></srai></template>
</category>
<category><pattern>COMMASEPARATENAMES * *</pattern>
<template><srai>DISPLAYNAME <star/></srai>, <srai>COMMASEPARATENAMES <star index="2"/></srai></template>
</category>
<category><pattern>MULTIPLENAMES *</pattern>
<template><think>
<set name="multipleids"><srai>MULTIPLEIDS <star/></srai></set>
</think>
<condition name="multipleids">
<li value="false">false</li>
<li><srai>COMMASEPARATENAMES <get name="multipleids"/></srai></li>
</condition></template>
</category>
<category><pattern>CONTACTLIST *</pattern>
<template><item><srai>DISPLAYNAME <star/></srai></item></template>
</category>
<category><pattern>CONTACTLIST * *</pattern>
<template><srai>CONTACTLIST <star/></srai><srai>CONTACTLIST <star index="2"/></srai></template>
</category>
<category><pattern>RESUMEACTION QUERY</pattern>
<template><srai>QUERYACTION</srai></template>
</category>
<category><pattern>RESUMEACTION CALL</pattern>
<template><srai>CALLACTION</srai></template>
</category>
<category><pattern>RESUMEACTION *</pattern>
<template>Stopped processing.</template>
</category>
<category><pattern>RESUMEACTION EMAIL</pattern>
<template><srai>EMAILACTION</srai></template>
</category>
<category><pattern>RESUMEACTION SMS</pattern>
<template><srai>SMSACTION</srai></template>
</category>
<category><pattern>RESUMEACTION ADD</pattern>
<template><srai>ADDACTION</srai></template>
</category>
<category><pattern>QUERYACTION</pattern>
<template><srai>CONTACTDEBUGINFO QUERYACTION</srai>
<think>
<set name="modecom">QUERY</set>
</think>
<condition name="checkedfamiliarname">
<li value="false"><srai>RESOLVE FAMILIARNAME</srai></li>
<li>
  <condition name="contactname">
  <li value="unknown"><srai>ASK CONTACTNAME</srai></li>
  <li><condition name="contactid">
      <li value="unknown"><srai>RESOLVE CONTACTNAME</srai></li>
      <li><condition name="externalname">
          <li value="unknown">
            <srai>QUERYINFO CONTACTID</srai>
          </li>
          <li><srai>QUERYINFO EXTERNAL</srai></li>
   	 </condition>
      </li>
      </condition>
  </li>
  </condition>
</li>
</condition></template>
</category>
<category><pattern>HOW OLD IS *</pattern>
<template><srai>WHEN IS <star/> S BIRTHDAY</srai></template>
</category>
<category><pattern>$SMS</pattern>
<template><srai>CONTACTDEBUGINFO SMS</srai>
<srai>CONTACTINIT</srai>
<srai>SMSACTION</srai></template>
</category>
<category><pattern>$SMS SMESSAGE *</pattern>
<template><srai>CONTACTINIT</srai>
<think>
<set name="messagebody"><star/></set>
</think>
<srai>SMSACTION</srai></template>
</category>
<category><pattern>$SMS *</pattern>
<template><srai>CONTACTINIT</srai>
<think><set name="contactname"><star/></set></think>
<srai>SMSACTION</srai></template>
</category>
<category><pattern>$SMS * SMESSAGE *</pattern>
<template><srai>CONTACTINIT</srai>
<think><set name="contactname"><star/></set>
<set name="messagebody"><star index="2"/></set>
</think>
<srai>SMSACTION</srai></template>
</category>
</aiml>
