|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opencyc.chat.ChatterBot
Provides a chat conversation interface to Cyc.
The chat conversation is in the form of a text conversation using asynchronous receiving and sending of messages. This class intializes the Cyc server connection, and initializes the chat interpreter, for each chat partner, then delegates the conversation understanding and responses to the chat partner's chat interpreter.
Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.
THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Field Summary | |
protected java.util.HashMap |
chatInterpreters
Dictionary of chat interpreters, chatUserUniqueId --> ChatInterpreter |
protected ChatSender |
chatSender
Sends messages to the chat system. |
protected java.util.HashMap |
chatUserModels
Dictionary of chat user models, chatUserUniqueId --> ChatUserModel |
protected CycAccess |
cycAccess
Provides wrappers for the Cyc API and manages the connection to the Cyc server. |
Constructor Summary | |
ChatterBot(ChatSender chatSender)
Creates a new ChatterBot object, given a ChatSender. |
Method Summary | |
void |
finalize()
Closes this ChatterBot, in particular the connection to the Cyc server. |
ChatUserModel |
getChatUserModel(java.lang.String chatUserUniqueId)
Returns the chat user model for the given chat partner. |
void |
initialize()
Initializes this ChatterBot, in particular the connection to the Cyc server. |
protected ChatInterpreter |
makeCharInterpreter(java.lang.String chatUserNickname,
java.lang.String chatUserUniqueId)
Makes a new chat interpreter object for a new chat partner, and stores it in the dictionary for later lookup. |
void |
receiveChatMessage(java.lang.String chatUserNickname,
java.lang.String chatUserUniqueId,
java.lang.String chatMessage)
Receives the given chat message from the given chat partner. |
void |
sendChatMessage(java.lang.String chatMessage)
Sends the given chat message into the chat system. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ChatSender chatSender
protected java.util.HashMap chatUserModels
protected java.util.HashMap chatInterpreters
protected CycAccess cycAccess
Constructor Detail |
public ChatterBot(ChatSender chatSender)
chatSender
- the object which connects the ChatterBot to the
chat system.Method Detail |
public void initialize() throws CycApiException, java.net.UnknownHostException, java.io.IOException, ChatException
protected ChatInterpreter makeCharInterpreter(java.lang.String chatUserNickname, java.lang.String chatUserUniqueId)
chatUserNickname
- the preferred name (possibly not unique) of the
chat partnerchatUserUniqueId
- the unique id assigned to the user by the chat
systempublic void finalize()
finalize
in class java.lang.Object
public void receiveChatMessage(java.lang.String chatUserNickname, java.lang.String chatUserUniqueId, java.lang.String chatMessage) throws CycApiException, java.io.IOException, java.net.UnknownHostException, ChatException
chatUserNickname
- the preferred name (possibly not unique) of the
chat partnerchatUserUniqueId
- the unique id assigned to the user by the chat
systemchatMessage
- the chat messagepublic void sendChatMessage(java.lang.String chatMessage) throws ChatException
chatMessage
- the chat messagepublic ChatUserModel getChatUserModel(java.lang.String chatUserUniqueId)
chatUserUniqueId
- the unique id assigned to the user by the chat
system
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |