AI and Python

Moshe Zadka moshez at math.huji.ac.il
Sat May 13 02:48:32 EDT 2000


On Fri, 12 May 2000, lexberezhny wrote:

> Hi,
>   I was wondering if anyone has dont any artificial inteligence with Python.
> I am writing a program for my school, which is ment to talk to kids in
> trouble, it will ask some simple questions based on the student answers,
> there is already a list of questions that we might want answered, so its not
> really AI. But I wanted any opinions on this topic. Thanks.

I have a bit of experience, and the lesson is that Python is good for AI,
but AI is hard objectively. I had a cute idea for a conversation AI, based
on learning and parroting, but with some cool tricks. I never got beyond
starting the data-structures in C++, I never got beyond seeing how it
would work in Scheme. I finished it in one Python-filled afternoon, and
discovered the idea sucked big time. I was glad I did it in Python,
because it only cost me one afternoon to discover the idea sucks.

Python has cool data-structures this purpose, and some cool functions: 
a few minutes of playing with string/re, and you already got past the
"lexing" part of parsing natlang. A few map(...), and you put your text in
some canonical form (all lower case, standard spelling of words, etc.).
filter() makes it really easy to get rid of noise words ("a", for
example). Writing a pseudo-parser with recursive decent and arbitrary look
ahead can be done with list.reverse(), and list.pop()'ing elements you
read.

Of course, all that doesn't really help you with AI -- it only helps you
quickly see any AI idea you think you have doesn't work because natlang is
too hard <wink>

but-it's-fun-playing-with-it-anyway-ly y'rs, Z.

--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com






More information about the Python-list mailing list