Jump to content

CleverBot Implementation for Scripts


LoudPacks

Recommended Posts

Library jar: http://www.mediafire.com/file/i5c5fkni41m78d9/ChatterBotLib.jar

 

Snippet:

ChatterBotFactory factory = new ChatterBotFactory();
ChatterBot bot = factory.create(ChatterBotType.CLEVERBOT);
ChatterBotSession botSession = bot.createSession();
String response = botSession.think("Text you want to respond to.");
System.out.println(response);

Sample:

465736b2e38bf12eae44c2290b7cf576.png

emote3.png Now if you want it for your scripts just put it into the onMessage maybe with some conditions about when it should respond / who it should respond to, etc.

 

I would run it on a separate thread incase the response takes a little while to complete.

Edited by LoudPacks
  • Like 8
Link to comment
Share on other sites

Responses are not instant, I'm using the same API as you. CleverBot generates a limited set of responses for every message you give. I use a recursive algorithm with a variable depth to ensure a larger pool of messages. You should query CleverBot on a separate thread using a Callable<String> to provide a Future<String> for when the processing is done.

Link to comment
Share on other sites

Responses are not instant, I'm using the same API as you. CleverBot generates a limited set of responses for every message you give. I use a recursive algorithm with a variable depth to ensure a larger pool of messages. You should query CleverBot on a separate thread using a Callable<String> to provide a Future<String> for when the processing is done.

 

I mean I set up 2 bots talking to each other and response times were ~<= 1s apart (every so often it would take a couple seconds). It would still be a good idea though none the less. I would assume users would only be sending one message at a time. 

Edited by LoudPacks
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...