Пример #1
0
  public String talkToSelf(String input) {
    try {

      ChatterBot bot1 = factory.create(ChatterBotType.CLEVERBOT);
      ChatterBotSession bot1session = bot1.createSession();

      ChatterBot bot2 = factory.create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477");
      ChatterBotSession bot2session = bot2.createSession();

      while (continueToTalkToSelf) {

        System.out.println("bot1> " + input);

        input = bot2session.think(input);
        log.info(input);
        System.out.println("bot2> " + input);
        log.info(input);

        input = bot1session.think(input);
      }
    } catch (Exception e) {
      Logging.logException(e);
    }

    return input;
  }
Пример #2
0
 public ChatBot() {
   factory = new ChatterBotFactory();
   try {
     bot = factory.create(ChatterBotType.CLEVERBOT);
   } catch (Exception e) {
     e.printStackTrace();
   }
   session = bot.createSession();
 }
Пример #3
0
 public boolean init() {
   try {
     factory = new ChatterBotFactory();
     // chatterbot = factory.create(type);
     chatterbot = factory.create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477");
     session = chatterbot.createSession();
   } catch (Exception e) {
     Logging.logException(e);
   }
   return true;
 }