Math.aiml

View: New views
7 Messages — Rating Filter:   Alert me  

Math.aiml

by KnyteTrypper :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here's something to play around with. At this point it doesn't handle
fractions or decimals. Folks using the 2002 ALICE AIML may need to
modify a few templates which otherwise shadow the math responses.
Seems to work well with the AAA, though.

<?xml version="1.0" encoding="UTF-8"?>
<aiml version="1.0">


       <!-- This program is open source code released under -->
       <!-- the terms of the GNU General Public License     -->
       <!-- as published by the Free Software Foundation.   -->
       <!-- Complies with AIML 1.0 Tag Set Specification -->
       <!-- as adopted by the ALICE A.I. Foundation.  -->
       <!-- (c) 2001-2003 ALICE A.I. Foundation.   -->
       <!-- Math.aiml written by SonoranDiaries -->
       <!-- Edited and revised by KnyteTrypper -->
        <!-- Last edit May 20 2006 -->


<category>
<pattern>* PLUS *</pattern>
<template><think><set name="num1"><star/ ></set> <set
name="number2"><person><star index="2"  /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="num1" /> + <get name="number2" />;
document.write("<br />result = " + result, "<br />");</script>
</template>
</category>

<category>
<pattern>* PLUS * EQUAL</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>* PLUS * EQUALS</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>WHAT IS * PLUS *</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>WHAT IS * + *</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>WHAT IS *+*</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>ADD * PLUS *</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>ADD * AND *</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>ADD * + *</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>ADD * + * =</pattern>
<template>
<srai>* PLUS *</srai>
</template>
</category>

<category>
<pattern>* MINUS *</pattern>
<template><think><set name="num1"><star /></set> <set
name="number2"><person><star index="2" /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="num1" /> - <get name="number2" />;
document.write("<br />result = " + result, "<br />");
</script>
</template>
</category>

<category>
<pattern>* MINUS * EQUALS</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>* MINUS * EQUAL</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM *</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM * EQUAL</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM * EQUALS</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>SUBTRACT * MINUS *</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>SUBTRACT * - *</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>SUBTRACT * - * =</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>SUBTRACT * AND *</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>SUBTRACT * SUBTRACTED FROM *</pattern>
<template>
<srai>* MINUS *</srai>
</template>
</category>

<category>
<pattern>* TIMES *</pattern>
<template><think><set name="num1"><star /></set> <set
name="number2"><person><star index="2" /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="num1" /> * <get name="number2" />;
document.write("<br />result = " + result, "<br />");
</script>
</template>
</category>

<category>
<pattern>* TIMES * EQUAL</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>* TIMES * EQUALS</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>* X *</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>* X * EQUAL</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>* X * EQUALS</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY *</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY * EQUAL</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY * EQUALS</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>MULTIPLY * X *</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>MULTIPLY * TIMES *</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>MULTIPLY * AND *</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>MULTIPLY * * *</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>

<category>
<pattern>MULTIPLY * MULTIPLIED BY *</pattern>
<template>
<srai>* TIMES *</srai>
</template>
</category>


<category>
<pattern>* DIVIDED BY *</pattern>
<template><think><set name="num1"><star /></set> <set
name="number2"><person><star index="2" /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="num1" /> / <get name="number2" />;
document.write("<br />result = " + result, "<br />");
</script>
</template>
</category>

<category>
<pattern>* DIVIDED BY * EQUAL</pattern>
<template>
<srai>* DIVIDED BY *</srai>
</template>
</category>

<category>
<pattern>* DIVIDED BY * EQUALS</pattern>
<template>
<srai>* DIVIDED BY *</srai>
</template>
</category>



<category>
<pattern>DIVIDE * DIVIDED BY *</pattern>
<template>
<srai>* DIVIDED BY *</srai>
</template>
</category>

<category>
<pattern>DIVIDE * DIVIDED BY * =</pattern>
<template>
<srai>* DIVIDED BY *</srai>
</template>
</category>

<category>
<pattern>DIVIDE * AND *</pattern>
<template>
<srai>* DIVIDED BY *</srai>
</template>
</category>

<category>
<pattern>DIVIDE * / *</pattern>
<template>
<srai>* DIVIDED BY *</srai>
</template>
</category>

<category>
<pattern>DIVIDE * / * =</pattern>
<template>
<srai>* DIVIDED BY *</srai>
</template>
</category>


<category>
<pattern>SQUARE ROOT OF *</pattern>
<template><think><set name="num"><star /></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var num=<get name="num" />;
document.write("<br />The square root of " +num+ " is ");
document.write(Math.sqrt(num), ".<br />");
document.write("PI is ");
document.write(Math.PI);
document.write(".<br />"+num+" raised to the 3rd power is " );
document.write(Math.pow(num,3));
document.write(".<br />");
</script>
</template>
</category>

<category>
<pattern>SQR RT OF *</pattern>
<template>
<srai>SQUARE ROOT OF <star /></srai>
</template>
</category>

<category>
<pattern>* TO THE POWER OF *</pattern>
<template><think>
<set name="num1"><star /></set><set name="num2"><person><star
index="2" /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var num=<get name="num" />;
var num2=<get name="num2" />;
document.write(".<br />"+num+" raised to the "+num2+" power is " );
document.write(Math.pow(num,num2));
document.write(".<br />");
</script>
</template>
</category>

<category>
<pattern>* RAISED TO THE * POWER</pattern>
<template>
<srai>* TO THE POWER OF *</srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * RD POWER</pattern>
<template>
<srai>* TO THE POWER OF *</srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * TH POWER</pattern>
<template>
<srai>* TO THE POWER OF *</srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * ND POWER</pattern>
<template>
<srai>* TO THE POWER OF *</srai>
</template>
</category>

<category>
<pattern>* POINT *</pattern>
<template>
<random>
<li>I can't do decimals yet sorry.</li>
<li>Give me some time I am still working on my basic math skills.</li>
<li>No decimals please, they throw me off.</li>
</random>
</template>
</category>


</aiml>
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Re: Math.aiml

by drwallace :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can see one problem right away, all those
<srai>* PLUS *</srai>
should be
<srai><star/> PLUS <star index="2"/></srai>

On 5/20/06, KnyteTrypper <knytetrypper@...> wrote:

> Here's something to play around with. At this point it doesn't handle
> fractions or decimals. Folks using the 2002 ALICE AIML may need to
> modify a few templates which otherwise shadow the math responses.
> Seems to work well with the AAA, though.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <aiml version="1.0">
>
>
>       <!-- This program is open source code released under -->
>       <!-- the terms of the GNU General Public License     -->
>       <!-- as published by the Free Software Foundation.   -->
>       <!-- Complies with AIML 1.0 Tag Set Specification -->
>       <!-- as adopted by the ALICE A.I. Foundation.  -->
>       <!-- (c) 2001-2003 ALICE A.I. Foundation.   -->
>       <!-- Math.aiml written by SonoranDiaries -->
>       <!-- Edited and revised by KnyteTrypper -->
>        <!-- Last edit May 20 2006 -->
>
>
> <category>
> <pattern>* PLUS *</pattern>
> <template><think><set name="num1"><star/ ></set> <set
> name="number2"><person><star index="2"  /></person></set></think>
> <random>
> <li>Let me try it this way. The answer is </li>
> <li>That's an easy one, The answer is </li>
> <li>Let me see. I think the answer is </li>
> <li>My calculator says the answer is </li>
> <li>I believe the answer is </li>
> <li>I don't enjoy math much. That's what computers are for. But the
> answer to that one is </li>
> </random>
> <script language="JavaScript">
> var result = <get name="num1" /> + <get name="number2" />;
> document.write("<br />result = " + result, "<br />");</script>
> </template>
> </category>
>
> <category>
> <pattern>* PLUS * EQUAL</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* PLUS * EQUALS</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>WHAT IS * PLUS *</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>WHAT IS * + *</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>WHAT IS *+*</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>ADD * PLUS *</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>ADD * AND *</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>ADD * + *</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>ADD * + * =</pattern>
> <template>
> <srai>* PLUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* MINUS *</pattern>
> <template><think><set name="num1"><star /></set> <set
> name="number2"><person><star index="2" /></person></set></think>
> <random>
> <li>Let me try it this way. The answer is </li>
> <li>That's an easy one, The answer is </li>
> <li>Let me see. I think the answer is </li>
> <li>My calculator says the answer is </li>
> <li>I believe the answer is </li>
> <li>I don't enjoy math much. That's what computers are for. But the
> answer to that one is </li>
> </random>
> <script language="JavaScript">
> var result = <get name="num1" /> - <get name="number2" />;
> document.write("<br />result = " + result, "<br />");
> </script>
> </template>
> </category>
>
> <category>
> <pattern>* MINUS * EQUALS</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* MINUS * EQUAL</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* SUBTRACTED FROM *</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* SUBTRACTED FROM * EQUAL</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* SUBTRACTED FROM * EQUALS</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>SUBTRACT * MINUS *</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>SUBTRACT * - *</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>SUBTRACT * - * =</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>SUBTRACT * AND *</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>SUBTRACT * SUBTRACTED FROM *</pattern>
> <template>
> <srai>* MINUS *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* TIMES *</pattern>
> <template><think><set name="num1"><star /></set> <set
> name="number2"><person><star index="2" /></person></set></think>
> <random>
> <li>Let me try it this way. The answer is </li>
> <li>That's an easy one, The answer is </li>
> <li>Let me see. I think the answer is </li>
> <li>My calculator says the answer is </li>
> <li>I believe the answer is </li>
> <li>I don't enjoy math much. That's what computers are for. But the
> answer to that one is </li>
> </random>
> <script language="JavaScript">
> var result = <get name="num1" /> * <get name="number2" />;
> document.write("<br />result = " + result, "<br />");
> </script>
> </template>
> </category>
>
> <category>
> <pattern>* TIMES * EQUAL</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* TIMES * EQUALS</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* X *</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* X * EQUAL</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* X * EQUALS</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* MULTIPLIED BY *</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* MULTIPLIED BY * EQUAL</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* MULTIPLIED BY * EQUALS</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>MULTIPLY * X *</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>MULTIPLY * TIMES *</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>MULTIPLY * AND *</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>MULTIPLY * * *</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
> <category>
> <pattern>MULTIPLY * MULTIPLIED BY *</pattern>
> <template>
> <srai>* TIMES *</srai>
> </template>
> </category>
>
>
> <category>
> <pattern>* DIVIDED BY *</pattern>
> <template><think><set name="num1"><star /></set> <set
> name="number2"><person><star index="2" /></person></set></think>
> <random>
> <li>Let me try it this way. The answer is </li>
> <li>That's an easy one, The answer is </li>
> <li>Let me see. I think the answer is </li>
> <li>My calculator says the answer is </li>
> <li>I believe the answer is </li>
> <li>I don't enjoy math much. That's what computers are for. But the
> answer to that one is </li>
> </random>
> <script language="JavaScript">
> var result = <get name="num1" /> / <get name="number2" />;
> document.write("<br />result = " + result, "<br />");
> </script>
> </template>
> </category>
>
> <category>
> <pattern>* DIVIDED BY * EQUAL</pattern>
> <template>
> <srai>* DIVIDED BY *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* DIVIDED BY * EQUALS</pattern>
> <template>
> <srai>* DIVIDED BY *</srai>
> </template>
> </category>
>
>
>
> <category>
> <pattern>DIVIDE * DIVIDED BY *</pattern>
> <template>
> <srai>* DIVIDED BY *</srai>
> </template>
> </category>
>
> <category>
> <pattern>DIVIDE * DIVIDED BY * =</pattern>
> <template>
> <srai>* DIVIDED BY *</srai>
> </template>
> </category>
>
> <category>
> <pattern>DIVIDE * AND *</pattern>
> <template>
> <srai>* DIVIDED BY *</srai>
> </template>
> </category>
>
> <category>
> <pattern>DIVIDE * / *</pattern>
> <template>
> <srai>* DIVIDED BY *</srai>
> </template>
> </category>
>
> <category>
> <pattern>DIVIDE * / * =</pattern>
> <template>
> <srai>* DIVIDED BY *</srai>
> </template>
> </category>
>
>
> <category>
> <pattern>SQUARE ROOT OF *</pattern>
> <template><think><set name="num"><star /></set></think>
> <random>
> <li>Let me try it this way. The answer is </li>
> <li>That's an easy one, The answer is </li>
> <li>Let me see. I think the answer is </li>
> <li>My calculator says the answer is </li>
> <li>I believe the answer is </li>
> <li>I don't enjoy math much. That's what computers are for. But the
> answer to that one is </li>
> </random>
> <script language="JavaScript">
> var num=<get name="num" />;
> document.write("<br />The square root of " +num+ " is ");
> document.write(Math.sqrt(num), ".<br />");
> document.write("PI is ");
> document.write(Math.PI);
> document.write(".<br />"+num+" raised to the 3rd power is " );
> document.write(Math.pow(num,3));
> document.write(".<br />");
> </script>
> </template>
> </category>
>
> <category>
> <pattern>SQR RT OF *</pattern>
> <template>
> <srai>SQUARE ROOT OF <star /></srai>
> </template>
> </category>
>
> <category>
> <pattern>* TO THE POWER OF *</pattern>
> <template><think>
> <set name="num1"><star /></set><set name="num2"><person><star
> index="2" /></person></set></think>
> <random>
> <li>Let me try it this way. The answer is </li>
> <li>That's an easy one, The answer is </li>
> <li>Let me see. I think the answer is </li>
> <li>My calculator says the answer is </li>
> <li>I believe the answer is </li>
> <li>I don't enjoy math much. That's what computers are for. But the
> answer to that one is </li>
> </random>
> <script language="JavaScript">
> var num=<get name="num" />;
> var num2=<get name="num2" />;
> document.write(".<br />"+num+" raised to the "+num2+" power is " );
> document.write(Math.pow(num,num2));
> document.write(".<br />");
> </script>
> </template>
> </category>
>
> <category>
> <pattern>* RAISED TO THE * POWER</pattern>
> <template>
> <srai>* TO THE POWER OF *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* RAISED TO THE * RD POWER</pattern>
> <template>
> <srai>* TO THE POWER OF *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* RAISED TO THE * TH POWER</pattern>
> <template>
> <srai>* TO THE POWER OF *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* RAISED TO THE * ND POWER</pattern>
> <template>
> <srai>* TO THE POWER OF *</srai>
> </template>
> </category>
>
> <category>
> <pattern>* POINT *</pattern>
> <template>
> <random>
> <li>I can't do decimals yet sorry.</li>
> <li>Give me some time I am still working on my basic math skills.</li>
> <li>No decimals please, they throw me off.</li>
> </random>
> </template>
> </category>
>
>
> </aiml>
> _______________________________________________
> This is the alicebot-general mailing list
> Reply to alicebot-general@...
> Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
> Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
> Learn to read at http://www.literacy.org/
>
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Re: Math.aiml

by KnyteTrypper :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 5/20/06, Dr. Rich Wallace <drwallace@...> wrote:
> I can see one problem right away, all those
> <srai>* PLUS *</srai>
> should be
> <srai><star/> PLUS <star index="2"/></srai>
>
Thanks. I'd checked the main category for each section, but not all of
them. Revision  upcoming.
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Re: Math.aiml

by KnyteTrypper :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> On 5/20/06, Dr. Rich Wallace <drwallace@...> wrote:
> > I can see one problem right away, all those
> > <srai>* PLUS *</srai>
> > should be> > <srai><star/> PLUS <star index="2"/></srai>
> >

My bad. That's what I get for depending too heavily on Pandorabots'
interpreter to spit AIML mistakes back out at me, lol. Hopefully
correct now.

<?xml version="1.0" encoding="UTF-8"?>
<aiml version="1.0">

        <!-- Free software (c) 2001-2003 ALICE A.I. Foundation -->
        <!-- This program is open source code released under -->
        <!-- the terms of the GNU General Public License     -->
        <!-- as published by the Free Software Foundation.   -->
        <!-- Complies with AIML 1.0 Tag Set Specification -->
        <!-- as adopted by the ALICE A.I. Foundation.  -->
        <!-- Math.aiml written by SonoranDiaries -->
        <!-- Edited and revised by KnyteTrypper -->
              <!-- Last edit May 20 2006 -->


<category>
<pattern>* PLUS *</pattern>
<template><think><set name="num1"><star/></set> <set
name="number2"><person><star

index="2"/></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="num1"/> + <get name="number2"/>;
document.write("<br/>result = " + result, "<br/>");</script>
</template>
</category>

<category>
<pattern>* PLUS * EQUAL</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* PLUS * EQUALS</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>WHAT IS * PLUS *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>WHAT IS * + *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>WHAT IS *+*</pattern>
<template>
<srai>* PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>ADD * PLUS *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>ADD * AND *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>ADD * + *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>ADD * + * =</pattern>
<template>
<srai><star /> PLUS <star index="2"/></srai>
</template>
</category>

<category>
<pattern>* MINUS *</pattern>
<template><think><set name="num1"><star/></set> <set
name="number2"><person><star

index="2"/></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="num1"/> - <get name="number2"/>;
document.write("<br/>result = " + result, "<br/>");
</script>
</template>
</category>

<category>
<pattern>* MINUS * EQUALS</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* MINUS * EQUAL</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM * EQUAL</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM * EQUALS</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * MINUS *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * - *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * - * =</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * AND *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * SUBTRACTED FROM *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* TIMES *</pattern>
<template><think><set name="num1"><star/></set> <set
name="number2"><person><star

index="2"/></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="num1"/> * <get name="number2"/>;
document.write("<br/>result = " + result, "<br/>");
</script>
</template>
</category>

<category>
<pattern>* TIMES * EQUAL</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* TIMES * EQUALS</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* X *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* X * EQUAL</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* X * EQUALS</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY * EQUAL</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY * EQUALS</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * X *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * TIMES *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * AND *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * * *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * MULTIPLIED BY *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>


<category>
<pattern>* DIVIDED BY *</pattern>
<template><think><set name="num1"><star/></set> <set
name="number2"><person><star

index="2"/></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="num1"/> / <get name="number2"/>;
document.write("<br/>result = " + result, "<br/>");
</script>
</template>
</category>

<category>
<pattern>* DIVIDED BY * EQUAL</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* DIVIDED BY * EQUALS</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>



<category>
<pattern>DIVIDE * DIVIDED BY *</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * DIVIDED BY * =</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * AND *</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * / *</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * / * =</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>


<category>
<pattern>SQUARE ROOT OF *</pattern>
<template><think><set name="num"><star/></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var num=<get name="num"/>;
document.write("<br/>The square root of " +num+ " is ");
document.write(Math.sqrt(num), ".<br/>");
document.write("PI is ");
document.write(Math.PI);
document.write(".<br/>"+num+" raised to the 3rd power is " );
document.write(Math.pow(num,3));
document.write(".<br/>");
</script>
</template>
</category>

<category>
<pattern>SQR RT OF *</pattern>
<template>
<srai>SQUARE ROOT OF <star/></srai>
</template>
</category>

<category>
<pattern>* TO THE POWER OF *</pattern>
<template><think>
<set name="num1"><star/></set><set name="num2"><person><star
index="2"/></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var num=<get name="num"/>;
var num2=<get name="num2"/>;
document.write(".<br/>"+num+" raised to the "+num2+" power is " );
document.write(Math.pow(num,num2));
document.write(".<br/>");
</script>
</template>
</category>

<category>
<pattern>* RAISED TO THE * POWER</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>*  RAISED TO THE * RD POWER</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * TH POWER</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * ND POWER</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* POINT *</pattern>
<template>
<random>
<li>I can't do decimals yet sorry.</li>
<li>Give me some time I am still working on my basic math skills.</li>
<li>No decimals please, they throw me off.</li>
</random>
</template>
</category>


</aiml>
_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Re: Math.aiml

by R. Vince :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I believe this would work for this particular catagory:

<category>
<pattern>* POINT *</pattern>
<template>
<template><think><set name="num1"><star/></set> <set
name="number2"><person><star index="2"/></person></set></think>
<script language="JavaScript">
var result = parseFloat(String(<get name="num1"/>) + '.' + String(<get
name="number2"/>));
document.write(result);</script>
</template>
</category>

-Ralph



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.6.1/343 - Release Date: 5/18/2006

_______________________________________________
This is the alicebot-general mailing list
Reply to alicebot-general@...
Unsubscribe and change preferences at http://list.alicebot.org/mailman/listinfo/alicebot-general
Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
Learn to read at http://www.literacy.org/

Re: Math.aiml

by ciprianmp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, I know this comes after almost 2 years, but I just tested your aiml these days and there were broken parts (only square was actually working).
So that I fixed the file and share it here for other users like me :D

But now comes my question: how can we change it to use php and not javascript? I mean, I want the result to be returned as value and not as javascript code.
The reason I ask for this is because I export the database messages into html logs for archive purposes, and from there, I want to convert them on-the-fly to pdf, for users downloads. Even in the html exported file, the java part goes broken, maybe due to the slashes not being stripped as they should, but anyway, i don't want javascript to be saved in log files. Not to talk about the further export to pdf... which of course won't work this way.
Does anyone have another solution for this?

PS: This is my first post, so I hope the attachment is working ;)
Thank you,
Ciprian M.



> On 5/20/06, Dr. Rich Wallace <drwallace@gmail.com> wrote:
> > I can see one problem right away, all those
> > <srai>* PLUS *</srai>
> > should be> > <srai><star/> PLUS <star index="2"/></srai>
> >

My bad. That's what I get for depending too heavily on Pandorabots'
interpreter to spit AIML mistakes back out at me, lol. Hopefully
correct now.

Re: Math.aiml

by ciprianmp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, as I was afraid to, the attachemnt feature is not working. So I will paste bellow the aiml content:
<?xml version="1.0" encoding="UTF-8"?>
<aiml version="1.0">

<!-- Free software (c) 2001-2003 ALICE A.I. Foundation -->
<!-- This program is open source code released under -->
<!-- the terms of the GNU General Public License -->
<!-- as published by the Free Software Foundation. -->
<!-- Complies with AIML 1.0 Tag Set Specification -->
<!-- as adopted by the ALICE A.I. Foundation. -->
<!-- Math.aiml written by SonoranDiaries -->
<!-- Edited and revised by KnyteTrypper -->
<!-- Last edit May 20 2006 -->

<meta name="author" content="Sonoran Diaries"/>
<meta name="editor" content="Knyte Trypper"/>
<meta name="corrector" content="Ciprian Murariu"/>
<meta name="language" content="en"/>

<category>
<pattern>* PLUS *</pattern>
<template><think>
<set name="number1"><star /></set>
<set name="number2"><person><star index="2" /></person></set>
</think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="number1"/> + <get name="number2"/>;
document.write(result+".");</script>
</template>
</category>

<category>
<pattern>* PLUS * EQUAL</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* PLUS * EQUALS</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>WHAT IS * PLUS *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>WHAT IS * + *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>WHAT IS *+*</pattern>
<template>
<srai>* PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>ADD * PLUS *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>ADD * AND *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>ADD * + *</pattern>
<template>
<srai><star /> PLUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>ADD * + * =</pattern>
<template>
<srai><star /> PLUS <star index="2"/></srai>
</template>
</category>

<category>
<pattern>* MINUS *</pattern>
<template><think><set name="number1"><star /></set><set name="number2"><person><star index="2" /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="number1"/> - <get name="number2"/>;
document.write(result+".");</script>
</template>
</category>

<category>
<pattern>* MINUS * EQUALS</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* MINUS * EQUAL</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM * EQUAL</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* SUBTRACTED FROM * EQUALS</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * MINUS *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * - *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * - * =</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * AND *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SUBTRACT * SUBTRACTED FROM *</pattern>
<template>
<srai><star /> MINUS <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* TIMES *</pattern>
<template><think><set name="number1"><star /></set>
<set name="number2"><person><star index="2" /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="number1"/> * <get name="number2"/>;
document.write(result+".");</script>
</template>
</category>

<category>
<pattern>* TIMES * EQUAL</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* TIMES * EQUALS</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* X *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* X * EQUAL</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* X * EQUALS</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY * EQUAL</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* MULTIPLIED BY * EQUALS</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * X *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * TIMES *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * AND *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * * *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>MULTIPLY * MULTIPLIED BY *</pattern>
<template>
<srai><star /> TIMES <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* DIVIDED BY *</pattern>
<template><think><set name="number1"><star /></set><set name="number2"><person><star index="2" /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var result = <get name="number1"/> / <get name="number2"/>;
document.write(result+".");</script>
</template>
</category>

<category>
<pattern>* DIVIDED BY * EQUAL</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* DIVIDED BY * EQUALS</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * DIVIDED BY *</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * DIVIDED BY * =</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * AND *</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * / *</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>DIVIDE * / * =</pattern>
<template>
<srai><star /> DIVIDED BY <star index="2" /></srai>
</template>
</category>

<category>
<pattern>SQUARE ROOT OF *</pattern>
<template><think><set name="number"><star/></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var number=<get name="number"/>;
document.write(":<br />The square root of "+number+" is ");
document.write(Math.sqrt(number)+".<br/>");
document.write("PI is "+Math.PI+".<br/>");
document.write(number+" raised to the 3rd power is "+Math.pow(number,3)+".");
</script>
</template>
</category>

<category>
<pattern>SQR RT OF *</pattern>
<template>
<srai>SQUARE ROOT OF <star/></srai>
</template>
</category>

<category>
<pattern>SQR *</pattern>
<template>
<srai>SQUARE ROOT OF <star/></srai>
</template>
</category>

<category>
<pattern>SQUARE *</pattern>
<template>
<srai>SQUARE ROOT OF <star/></srai>
</template>
</category>

<category>
<pattern>* TO THE POWER OF *</pattern>
<template><think><set name="number1"><star /></set><set name="number2"><person><star index="2" /></person></set></think>
<random>
<li>Let me try it this way. The answer is </li>
<li>That's an easy one, The answer is </li>
<li>Let me see. I think the answer is </li>
<li>My calculator says the answer is </li>
<li>I believe the answer is </li>
<li>I don't enjoy math much. That's what computers are for. But the
answer to that one is </li>
</random>
<script language="JavaScript">
var number1=<get name="number1"/>;
var number2=<get name="number2"/>;
document.write(":<br/>"+number1+" raised to the "+number2+" power is "+Math.pow(number1,number2)+".");
</script>
</template>
</category>

<category>
<pattern>* POWER *</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * POWER</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * RD POWER</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * TH POWER</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* RAISED TO THE * ND POWER</pattern>
<template>
<srai><star /> TO THE POWER OF <star index="2" /></srai>
</template>
</category>

<category>
<pattern>* POINT *</pattern>
<template><think><set name="number1"><star /></set><set name="number2"><person><star index="2" /></person></set></think>
<random>
<li>I can't do decimals yet sorry.</li>
<li>Give me some time I am still working on my basic math skills.</li>
<li>No decimals please, they throw me off.</li>
</random>
</template>
</category>
</aiml>



Well, I know this comes after almost 2 years, but I just tested your aiml these days and there were broken parts (only square was actually working).
So that I fixed the file and share it here for other users like me :D

But now comes my question: how can we change it to use php and not javascript? I mean, I want the result to be returned as value and not as javascript code.
The reason I ask for this is because I export the database messages into html logs for archive purposes, and from there, I want to convert them on-the-fly to pdf, for users downloads. Even in the html exported file, the java part goes broken, maybe due to the slashes not being stripped as they should, but anyway, i don't want javascript to be saved in log files. Not to talk about the further export to pdf... which of course won't work this way.
Does anyone have another solution for this?

PS: This is my first post, so I hope the attachment is working ;)
Thank you,
Ciprian M.


KnyteTrypper wrote:
> On 5/20/06, Dr. Rich Wallace <drwallace@gmail.com> wrote:
> > I can see one problem right away, all those
> > <srai>* PLUS *</srai>
> > should be> > <srai><star/> PLUS <star index="2"/></srai>
> >

My bad. That's what I get for depending too heavily on Pandorabots'
interpreter to spit AIML mistakes back out at me, lol. Hopefully
correct now.