当前位置: 首页>>代码示例>>Java>>正文


Java ChatterBotType类代码示例

本文整理汇总了Java中com.google.code.chatterbotapi.ChatterBotType的典型用法代码示例。如果您正苦于以下问题:Java ChatterBotType类的具体用法?Java ChatterBotType怎么用?Java ChatterBotType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChatterBotType类属于com.google.code.chatterbotapi包,在下文中一共展示了ChatterBotType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initGui

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
@Override
public void initGui()
{
	this.reponse = this.getRandomString();
       this.textfield = new GuiTextField(this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
       this.textfield.setMaxStringLength(300);
       this.textfield.setFocused(true);
       
       this.factory = new ChatterBotFactory();
       try {
		this.bot = this.factory.create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477");
        this.bot_session = this.bot.createSession();
	} catch (Exception e) {
		e.printStackTrace();
	}
       
       this.buttonList.add(new GuiButton(42, this.width / 4, this.height - 40, this.width / 2, 20, ChatColor.RESET + "Say"));
}
 
开发者ID:GhostMonk3408,项目名称:MidgarCrusade,代码行数:19,代码来源:GuiSlave.java

示例2: execute

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
@Override
public void execute(GnarMessage message, String[] args)
{
    try
    {
        if (bot == null)
        {
            bot = factory.create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477");
            session = bot.createSession();
            message.reply("Pandora-Bot session created for the server.");
        }
        
        String input = StringUtils.join(args, " ");
        
        String output = session.think(input);
        message.replyRaw("**[PandoraBot]** ─ `" + output + "`");
    }
    catch (Exception e)
    {
        message.reply("PandoraBot has encountered an exception. Resetting PandoraBot.");
        bot = null;
    }
}
 
开发者ID:Gnar-Team,项目名称:Legacy-GN4R,代码行数:24,代码来源:PandorabotCommand.java

示例3: execute

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
@Override
public void execute(GnarMessage message, String[] args)
{
    try
    {
        if (!sessionMap.containsKey(message.getAuthor()))
        {
            ChatterBot bot = factory.create(ChatterBotType.CLEVERBOT);
            sessionMap.put(message.getAuthor(), bot.createSession());
        }
        message.replyRaw(sessionMap.get(message.getAuthor()).think(StringUtils.join(args, " ")));
    }
    catch (Exception e)
    {
        message.reply("Chat Bot encountered an exception. Restarting. `:[`");
        sessionMap.remove(message.getAuthor());
    }
}
 
开发者ID:Gnar-Team,项目名称:Legacy-GN4R,代码行数:19,代码来源:PrivateCleverbotCommand.java

示例4: execute

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
@Override
public void execute(GnarMessage message, String[] args)
{
    try
    {
        if (bot == null)
        {
            bot = factory.create(ChatterBotType.CLEVERBOT);
            session = bot.createSession();
            message.reply("Clever-Bot session created for the server.");
        }
        
        String input = StringUtils.join(args, " ");
        
        String output = session.think(input);
        message.replyRaw("**[CleverBot]** ─ `" + output + "`");
    }
    catch (Exception e)
    {
        message.reply("CleverBot has encountered an exception. Resetting CleverBot.");
        bot = null;
    }
}
 
开发者ID:Gnar-Team,项目名称:Legacy-GN4R,代码行数:24,代码来源:CleverbotCommand.java

示例5: talkToSelf

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
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.logError(e);
	}

	return input;
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:27,代码来源:CleverBot.java

示例6: handle

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
private void handle(ChatMessage message) throws Exception {
    if (!CHATBOT_TROLL) {
        try {
            String[] args = message.getContent().split(" ");
            if (commands.containsKey(args[0])) {
                String response = commands.get(args[0]).command(message, Arrays.copyOfRange(args, 1, args.length));
                if (response == null) return;
                Keyboard.type(response);
                if (DEBUG) System.out.println(response);
            }
        } catch (SkypeException e) {
            System.out.println("invalid message " + message);
            e.printStackTrace();
        }
    } else {
        ChatterBotSession bot;
        if (!cleverBots.containsKey(message.getSenderId()))
            cleverBots.put(message.getSenderId(), botFactory.create(ChatterBotType.CLEVERBOT).createSession());
        bot = cleverBots.get(message.getSenderId());
        Keyboard.type(bot.think(
                message.
                        getContent()));
    }
}
 
开发者ID:rowtn,项目名称:SkypeNet,代码行数:25,代码来源:SkypeNet.java

示例7: talkToSelf

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
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.logError(e);
  }

  return input;
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:27,代码来源:CleverBot.java

示例8: CleverBot

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
public CleverBot() {


        try {
            cleverBotSession = getChatFactory()
                    .create(ChatterBotType.CLEVERBOT)
                    .createSession();
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Failed to build clever bot");
        }
    }
 
开发者ID:zom,项目名称:zombot-java,代码行数:13,代码来源:CleverBot.java

示例9: PandoraBot

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
public PandoraBot() {
    try {
        pandoraBotSession = getChatFactory()
                .create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477")
                .createSession();
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println("Failed to build pandora bot");
    }
}
 
开发者ID:zom,项目名称:zombot-java,代码行数:11,代码来源:PandoraBot.java

示例10: createClever

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
private ChatterBot createClever() {
    try {
        return new ChatterBotFactory()
            .create(ChatterBotType.CLEVERBOT, sentryProperties.getDiscord().getCleverBotApiKey());
    } catch (Exception e) {
        log.warn("Could not create CleverBot session", e);
    }
    return null;
}
 
开发者ID:quanticc,项目名称:sentry,代码行数:10,代码来源:Chatter.java

示例11: setAi

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
public void setAi(Chat chat, String id) {
	if(sessions.containsKey(chat)) {
		clearChat(chat);
	}
	Core.send(chat, "Creating new bot with AI-ID " + id);
	try {
		bots.put(chat, factory.create(ChatterBotType.PANDORABOTS, id));
		sessions.put(chat, bots.get(chat).createSession());
	} catch (Exception e) {
		Core.send(chat, "Error: " + e.getMessage());
		return;
	}
	Core.send(chat, "Session created");
}
 
开发者ID:Kitt3120,项目名称:ViperBot,代码行数:15,代码来源:ChatBot.java

示例12: createBotSessions

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
/**
 * Creates Bot and the Bot Session.
 * Uses CleverBot.
 */
private void createBotSessions() {
    try {
        bot = botFactory.create(ChatterBotType.CLEVERBOT);
        botSession = bot.createSession();
    } catch (Exception e) {
        interrupt();
    }
}
 
开发者ID:iSach,项目名称:Samaritan,代码行数:13,代码来源:CleverBotListener.java

示例13: CleverbotSession

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
public CleverbotSession() throws Exception
{
	JSONObject json = new JSONObject(Util.getFileContents("config.json"));
	ChatterBotFactory factory = new ChatterBotFactory();
	ChatterBot bot = factory.create(ChatterBotType.CLEVERBOT, json.getString("cleverbotAPIKey"));

	session = bot.createSession(Locale.ENGLISH);
}
 
开发者ID:Vauff,项目名称:Maunz-Discord,代码行数:9,代码来源:CleverbotSession.java

示例14: init

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
public boolean init() {
	try {
		factory = new ChatterBotFactory();
		// chatterbot = factory.create(type);
		chatterbot = factory.create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477");
		// chatterbot = factory.create(ChatterBotType.CLEVERBOT);
		session = chatterbot.createSession();
	} catch (Exception e) {
		Logging.logError(e);
	}
	return true;
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:13,代码来源:CleverBot.java

示例15: CommandCleverbot

import com.google.code.chatterbotapi.ChatterBotType; //导入依赖的package包/类
public CommandCleverbot() {
    try {
        bot = new ChatterBotFactory().create(ChatterBotType.CLEVERBOT).createSession();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:rowtn,项目名称:SkypeNet,代码行数:8,代码来源:CommandCleverbot.java


注:本文中的com.google.code.chatterbotapi.ChatterBotType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。