Jump to content

CleverBot Implementation for Scripts


Recommended Posts

Posted (edited)

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
Posted

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.

Posted (edited)

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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