Aine, and AineL (Aine Language) User's Manual.
(c) 2003 David Calinski


History:
--------

    Aine merges two "AI" projects:

    1. A.L.I.C.E./AIML by Dr Richard S. Wallace 
	(ALICE is winner of the Loebner AI Contest for 2000 and 2001)

    2. MegaHAL by Jason Hutchens
	(came second in the 1998 Loebner AI Contest)
	UPDATE: MegaHAL code is no longer used in Aine,
		maybe it will come back later...
	

Aine Language (AineL) is based on AIML (Artificial Intelligence Mark-Up Language).
I was tired of editing AIML by hand, and I was tired of AIML specification.
Also, some rules of AIML 1.01 were hard to implement in my interpreter.
That's why I developed AineL.
It was primary only for my private project, based on Hippie [http://hippie.sf.net].
But later I realized that many people may want something like this,
so why not share ideas, code, and Aine itself?

So here it is.


Aine should run on any O/S, but I develop it on FreeBSD and Debian Linux.
(Well, users of Windows can have problems due to Windows messed "new line" characters).

You can modify and redistributed Aine under terms of GNU General Public License v. 2,
as published by Free Software Foundation.

You don't really have to, but I will be glad if you will send me your corrections
and/or good modifications of the code (to neodave[at]gmx.net).


Now let's have a look at AineL:
-------------------------------

As AineL is based on AIML. Let's look on an AIML example:

	<category>
		<pattern>HELLO MY NAME IS *</pattern>
		<template>
			<random>
				<li>Hi, nice too meet you 
				<set name="name">
				<set name="it">
				<set name="topic">
					<star/>
						</set></set></set></li>
				<li><srai>MY NAME IS<star/></srai></li>
			</random>
		</template>
	</category>


Piece of code in AineL which does exactly the same:

	+[HELLO MY NAME IS *]
	[<r><l>Hi, nice to meet you <s=name,it,topic><*></s></l>
	<l>{MY NAME IS <*>}</l></r>]


As you could see: AineL is much more readable (at least IMHO).
Less typing = less work.
Less files size = less wasted time to skim them, 
		  less wasted time to search for something in them, etc.
		  = better your bot.


If you already know AIML, you will quickly find yourself in AineL:


	AineL				AIML

	+[   ]				<pattern>   </pattern>
	-[   ]				<template>   </template>
	<g=a_variable>			<get name="a_variable"/>
	<r>				<random>
	<l>				<li>
	</l>				</li>
	<k>				<li> (in condition code)
	</k>				</li> (in condition code)
	</r>				</random>
	<t>  </t>			<that>	</that>
	{				<srai>
	}				</srai>
	<h>				<think>		("h" in AineL is from "_H_ide results")
	</h>				</think>
	<*>				<star/>
	<*=2>				<star index="2">
	<*=3>				<star index="3">
	<s=a_variable>yawn</s>		<set name="a_variable">yawn</set>
	<s=topic,it>yawn</s>		<set name="topic"><set name="it">yawn</set></set>


Note:
1. <person>, <person/>, <person2>, <personf> are exactly the same as in AIML.
2. There is no <category> equivalent tag in AineL (there is no need for it).
3. <s=...> may take many arguments, not just 1 or 2.
4. Conditional reply: in AIML there are 3 kinds of <condition> tags, in AineL there is *only one*.
Example:

	+[WHAT IS MY GENDER]
	-[<c=gender>
	<k=he>You are he.</k>
	<k=she>You are she.</k>
	<k>I really don't know what is your gender..</k></c>]

So format is:
		<c=a_variable_name>
			<k=a_value>first reply</k>
			<k=other_value>second reply</k>
			...
			...
			<k>*Optional* default reply</k>
		</c>



What AineL have, and what AIML don't have:
------------------------------------------

1. <save>/<usesaved> idea by Jacco Bikker.
2. Mood.
3. Matching questions and exclamations.


1)
<save>/<usesaved>
-----------------
    A simple example of <save>/<usesaved> code:

	+[I LIKE TO CHAT WITH CHAT BOTS]
	-[<save>I was thinking... why do you like chatting with chat bots so much? :)</save>
	I see. You are not the only one :)]

(Comment: sentence between <save> </save> tags won't be showed to user. Will be just put on a stack of "emergency answers".)

	+[HMM]
	-[Huh?]

(Comment: Below: user is saying something that bot don't know how to reply. But instead of silly default reply, bot will reply from stack (if there is something on the stack) of "use/usesaved" replies.)

	+[*]
	-[<usesaved>
	<r><l>Could you rephrase it?</l>
	<l>I don't understand you</l>
	<l>Not many people express in that way.</l></r>]


So, now a little conversation:

Me: I like to chat with chat bots.
Bot: I see. You are not the only one.
Me: hmm.
Bot: Huh?
Me: you know, most bots are boring, they don't really understand people.
Bot: (Without <use>/<usesaved> bot could reply: I don't understand you.)
(But with some previous replies on the "emergency" stack will reply:
I was thinking... why do you like chatting with chat bots so much? :)


The example was pretty simple. But believe me it works amazing, when you chat with a bot, and it incidentally ask you,
e.g. "By the way, why did you said you don't like [something you said you don't like before]?" instead of silly default response.


2) 
Mood
----
    Aine has a mood. Two variables: happieness (from 0 to 9), and sympathy to user (0-9).

If happiness = 0, Aine is very sad.
If happiness = 9, Aine is very happy.
If sympathy = 0, Aine is mad at user, she (in CGI version) will even don't respond to user then.
If sympathy = 9, Aine likes user very much.

E.g.:

+[WHAT IS YOUR MOOD]
-[<r><l>Indifferent.</l>
<l=99>I am very happy. :-)</l>
<l=95>I am very happy.</l>
<l=59>I am OK. :-)</l>
<l=15>I am sad...</l>
<l=40>Get lost...</l>
<l=00>Why do you ask..? I don't think you really care about my mood...</l></r>]


If you ask Aine for mood, and it will be sad there are far more chances that Aine will reply "I am sad".
But it's kinda "random" reply, anyway.

Mood can be change by "mood changer" tag:
+[I DO NOT LIKE YOU]
-[Ok, I will not like you too./=54]

Yes, this "/=54" on the *end* (this have to be on the *end* of bot reply, and is of course deleted from Aine output to user):

/=55 means no change of happiness nor sadness.
/=45 means happiness = happieness -1
/=65 means happiness = happiness +1
/=67 means happieness = happiness +1; sympathy = sympathy + 2;

etc.


3) 
Matching questions and excalamtions
-----------------------------------
    In AineL you can write:
    +[YOUR NAME?]
    -[My name is <g=botname>.]
    
    and
    
    +[YOUR NAME]
    -[What's with my name?]
    
    And if user asks your bot "Your name?" the bot will reply to the question.
    If, in user input, there isn't an question mark, the second category will get fired.
    (With output "What's with my name?").


Final Notes:
------------
Please read carefully contents of GNU General Public License before using Aine.


Thanks
------
Aine is based on work of many people - see thanks.txt for the list.


--
  David Calinski
  neodave at gmx.net
  www.neodave.civ.pl
