Natural Language Processing
From AI Wiki
There are many possible ways that Iams can be deployed and be useful and not all of them necessarily talk. But the majority of them will probably have at least some minimal capability of verbal communication. Chat-bots are an extreme example where almost all they do is NLP and coming up with what is hopefully interesting or entertaining conversation. If the Iam you have in mind is going to have as its main task the providing of conversation, then you're probably best off taking one of the chat-bot sample projects and start building your Iam around one of those.
If the conversation of your Iam mostly serves the purpose of trying to find out what the other party wants from it in a given specific context, then employing a full-fledged chat-bot may simply be overkill. Avatar Reality has developed the CHAT-L language to support the development of NLP capabilities in Iams. CHAT-L comes in two types of file-format. There are the topic files with the .top suffix as they are used by the Suzette chat-bot and by the CHAT-L sandbox. Extensive documentation about CHAT-L and the chat-bot Suzette developed by Bruce Wilcox can be found here: [CHAT-L] And there's a formal XML definition of CHAT-L defined in a XSD (Xml Schema Definition) file that can be found here: File:Chatl.xsd. There's a small but far-reaching difference between the two file-formats and that is that the XML files allow the specification of a (Java) function to call instead of producing a preset answer.
In the section about chat-bots we already briefly mentioned the ChatProcessor class. (In the com.avatar_reality.blue_mars.chat package) What this class does is maintain a set of CHAT-L rules and provide a way to match incoming text input to those rules. The class com.avatar_reality.blue_mars.iam.util.XMLUtil provides a convenience method that takes an XML file and adds any CHAT-L rules it contains to a ChatProcessor instance. This method is called addChatLFile(). The third parameter to this method is an anonymous handler object. Whenever a CHAT-L rule specifies a function, it will try to call this function on the handler object using reflection. So whenever you receive any input text in your Iam's behavior, you can simply call chatProcessorInstance.processInput(text,entityName) and it will automatically call the corresponding Java function if a rule matched. If a rule was matched that did not supply a function-name to call then by default the function 'reply' will be called which can then be used to 'say' the output embedded in the CHAT-L rule. The ChatProcessor currently doesn't support all of CHAT-L's constructs. But over time we hope to reduce the gap more and more.
It's probably not so easy to understand how this all works in practice so the suggested approach is to first take a look at the Marvin sample project for a real-life example how to use this functionality effectively.