⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chatbot.java

📁 一个关于CHATBOT的程序(人式智能方面)
💻 JAVA
字号:
package ijp.assignment1.chat;

import ijp.assignment1.langen.*;


/**
 * A class representing a digital persona known as a chat bot. 
 * The chat bot can start conversations and reply to remarks. 
 * <p> Used in IJP assignments 1 and 2.</p>
 * 
 * @author Judy Robertson, Nigel Goddard
 */
public class ChatBot {

	/**
	 * The name of the character
	 */    
	private String name;

	/**
	 * A textual description of the appearance and personality of this character
	 */
	private String description;

	private TemplateLanguageGenerator templateLanguageGenerator;

	/**
	 * Create a ChatBot, initialise the language generator
	 *
	 */
	public ChatBot() {
		templateLanguageGenerator= new TemplateLanguageGenerator();
	}

	/**
	 * Initiate a conversation about any topic. Generate a starting sentence
     * 
	 * @return A sentence with which to start a conversation
	 */
	public String startConversation() {
    String startSentence=templateLanguageGenerator.generateSentence();
	return startSentence;
	}

	/**
	 * Generate a response to the specified remark
     * 
	 * @param remark The comment which must be responded to
     * 
	 * @return A sentence which represents a reply to the specified remark
	 */
	public String reply(String remark) {
	String reply=templateLanguageGenerator.generateReply(remark);
	return reply;
	}

	

	/**
	 * Gets the textual description of what the chat bot looks like and 
     * its personality
     * 
	 * @return A textual description of the chat bot
	 */
	public String getDescription() {
	return description;
	}

	/**
	 * Gets the name of the chat bot
     * 
	 * @return The name of this digital persona
	 */
	public String getName() {
	return name;
	}

	/**
	 * Sets up the textual description of the chat bot's appearance and personality
     * 
	 * @param string The textual description of the bot
	 */
	public void setDescription(String string) {
	description=string;
	}

	/**
	 * Sets up the name of this digital persona
     * 
	 * @param string The name of the bot
	 */
	public void setName(String string) {
		name=string;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -