Proto-Chatbot at Last

(This is a copy of my blog post on the wordpress opencog brainwave blog, originally made on 28 April 2009 -- Linas Vepstas).

Hands-on tutorials are planned for the next month or so; we’ve already had a few on PLN, and my turn is coming up, for the opencog NLP pipeline. So I thought I’d wire up a cute demo for the occasion: a rough, crude IRC chatbot, “La Cogita”. It can answer simple questions about straightforward statements. Nothing fancy … it doesn’t do any reasoning at all … but it can work off of the basic syntactic structure of English sentences to find answers. Thus, for example:

<linas> Mary ate a mango
<cogita-bot> Hello linas, parsing ...
<cogita-bot> linas, you made a statement: Mary ate a mango
<linas> what did Mary eat?
<cogita-bot> Hello linas, parsing ...
<cogita-bot> linas, you asked a question: what did Mary eat?
<cogita-bot> The answer to your question is: mango

Its meant to be a demo of the basic NLP pipeline within OpenCog. It takes input text, runs it throught the Link Grammar + RelEx parser, imports the results into the OpenCog atomspace, sucks in a small common-sense database, and waits for questions to be posed. The common-sense database is derived from MIT’s ConceptNet (OpenMind/CommonSense project), and so one can have interactions like the following:

<linas> cogita-bot: what is a saxophone?
<cogita-bot> Hello linas, parsing ...
<cogita-bot> linas, you asked a question: what is a saxophone?
<cogita-bot> No answer was found to your question.
<linas> hmm
<linas> cogita-bot: what is an instrument?
<cogita-bot> Hello linas, parsing ...
<cogita-bot> linas, you asked a question: what is an instrument?
<cogita-bot> The answer to your question is: woodwind r bass harmonica An_Oboe Oboe megaphone saxophone chronometer drum scale ukulele cymbal instrument
<linas> Heh. Complete with assorted linguistic garbage :-)

You get the idea. Don’t ask it anything more complicated than the above examples: it will fail to find any answer. Again, it does no reasoning at all. Its as thick as a brick. You can test-drive it at the #opencog channel on the IRC network. Assuming its not down for development.

Next up: wire in NLGen for natural-language output, and start taking baby steps in actual reasoning. Anyway, I’m pretty excited, as this means that a lot of the basic bits&pieces are working, and I can now dive into the deep end, and start working on the hard stuff.

– Linas Vepstas