Hi,

my name is Dirk Scheuring, I'm a writer based in Cologne, Germany, and
I want to write something about AI that can only be expressed by using
AI technology and technique. You could say that what I aim for is a
chatbot, but it's a bot that works quiet different from the norm; at
it's core, there is a functional program, and on the fringe, there's
lots of state information.

I have a working prototype, written in AIML, the language in which the
famous Alicebot was written. Most bots written in AIML use a simple
stimulus-response conception of dialogue, without using (sequences of)
state, self-reflection, or other advanced concepts. So some people who
have only cursory knowledge of this language think that it's too
simple to be doing anything with that might be computationally
interesting. I know this to be false.

AIML is sort of a micro-version of a Lisp, with String being the only
type, and recursion over everything (powerful and dangerous). You can
write serious functions with it [1], but you have to abuse it. And I
heavily abused the language to make it do what I want. I managed to
build a prototype that does something interesting, but only does it
for like ten conversational strokes, because then the interpreter's
stack overflows, causing an infinite loop.

I need to implement my ideas in a different language - one that I
don't have to abuse to do complex stuff. I've looked at various
functional languages, and have now installed two, Scala and Clojure,
doing a couple tutorials at the respective REPLs. I have a hunch that
Clojure might turn out to be closer to what I already have in AIML,
but I'm not sure yet. Maybe you can help me decide.

AIML is an XML dialect; its most important construct is the <category/
>, which has a <pattern/> and a <template/>. This is a default
<category/>, which matches any string:

<category>
  <pattern>*</pattern>
  <template>
    <srai>SOMEFUNCTION</srai>
  </template>
</category>

The <srai/> element in the <template/> means that I invoke the pattern
matcher recursivly to match SOMEFUNCTION. How can I express this in
Clojure?

The next primitive construction I need to translate is substitution:

<category>
  <pattern>* RAN *</pattern>
  <template>
    <srai><star index="1"/> RUNNING <star index="2"/></srai>
  </template>
</category>

This code matches the substring RAN in the middle of a set of other
substrings, and substitutes it for RUNNING, leaving the values before
and after it untouched for the next recursion. And I need to know how
to do:

<category>
  <pattern>* MADONNA *</pattern>
  <template>
    <think>
      <set name="celebrity">Madonna</set>
    </think>
    <srai><star index="1"/> <star index="2"/></srai>
  </template>
</category>

The above category "extracts" a substring from the input and saves it
to a (global) variable; the other substrings are up for another round
of pattern matching. Another important low-level one is:

<topic name="* MYTOPIC *">
  <category>
    <pattern>*</pattern>
    <template>
      <srai>SOMEOTHERFUNCTION</srai>
    </template>
  </category>
</topic>

This is again the catch-all <*> pattern, but in a context, represented
by the substring MYTOPIC in between these other substrings. So in this
case, the default <pattern/> has a <template/> that calls
SOMEOTHERFUNCTION. Is this something I would do with Multimethods in
Clojure?

There's lots more, but this is the primitive stuff that I need to
comprehend first. My model does what I call "semantic compression" -
it transforms and analytically stores (parts of) the input string -,
then finds a matching object which has methods to generate facts and
rules, the core of an output, which might then be extended front and
back, depending on what's in the input and what's in the current state
(that's "semantic expansion")...and finally, the first letter of the
output is cast to uppercase, a dot or bang or questionmark is put at
the end, and a special object writes the formated output (say, to a
webpage, or to an IRC channel). I know how to do this in AIML, at
least up to the point when the interpreter crashes, because I used the
language in a way it wasn't designed to be used (but it's valid AIML -
the spec allows some unmentioned things; plus it is functional, with
continuation-passing to boot). I want to learn how to do this in
Clojure, and appreciate any pointers and tips.

Best regards,

Dirk Scheuring

[1] Simple FP example in AIML:
http://list.alicebot.org/pipermail/alicebot-style/2002-September/000231.html

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to