本文整理汇总了C#中AIMLbot.Request类的典型用法代码示例。如果您正苦于以下问题:C# Request类的具体用法?C# Request怎么用?C# Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Request类属于AIMLbot命名空间,在下文中一共展示了Request类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: testResultHandlers
public void testResultHandlers()
{
this.mockUser = new User("1", this.mockBot);
Assert.AreEqual("", this.mockUser.getResultSentence());
Request mockRequest = new Request("Sentence 1. Sentence 2",this.mockUser,this.mockBot);
Result mockResult = new Result(this.mockUser, this.mockBot, mockRequest);
mockResult.InputSentences.Add("Result 1");
mockResult.InputSentences.Add("Result 2");
mockResult.OutputSentences.Add("Result 1");
mockResult.OutputSentences.Add("Result 2");
this.mockUser.addResult(mockResult);
Result mockResult2 = new Result(this.mockUser, this.mockBot, mockRequest);
mockResult2.InputSentences.Add("Result 3");
mockResult2.InputSentences.Add("Result 4");
mockResult2.OutputSentences.Add("Result 3");
mockResult2.OutputSentences.Add("Result 4");
this.mockUser.addResult(mockResult2);
Assert.AreEqual("Result 3", this.mockUser.getResultSentence());
Assert.AreEqual("Result 3", this.mockUser.getResultSentence(0));
Assert.AreEqual("Result 1", this.mockUser.getResultSentence(1));
Assert.AreEqual("Result 4", this.mockUser.getResultSentence(0, 1));
Assert.AreEqual("Result 2", this.mockUser.getResultSentence(1, 1));
Assert.AreEqual("", this.mockUser.getResultSentence(0, 2));
Assert.AreEqual("", this.mockUser.getResultSentence(2, 0));
Assert.AreEqual("Result 3", this.mockUser.getThat());
Assert.AreEqual("Result 3", this.mockUser.getThat(0));
Assert.AreEqual("Result 1", this.mockUser.getThat(1));
Assert.AreEqual("Result 4", this.mockUser.getThat(0, 1));
Assert.AreEqual("Result 2", this.mockUser.getThat(1, 1));
Assert.AreEqual("", this.mockUser.getThat(0, 2));
Assert.AreEqual("", this.mockUser.getThat(2, 0));
}
开发者ID:cberberian,项目名称:Brain,代码行数:32,代码来源:UserTests.cs
示例2: Result
/// <summary>
/// Creates an instance of the Result class.
/// </summary>
/// <param name="user">The user for whom this is a result</param>
/// <param name="request">The request that originated this result</param>
public Result(User user, Request request)
{
User = user;
Request = request;
Request.Result = this;
_splitters = ChatBot.Splitters.ToArray();
}
开发者ID:rlebowitz,项目名称:ai,代码行数:12,代码来源:Result.cs
示例3: Main
static void Main(string[] args)
{
_bot = InstantiateBot();
_user = new User("chris", _bot);
var input = string.Empty;
Console.WriteLine("Say somthing to begin teaching me.");
while (input.ToLower() != "q")
{
input = GetUserInput();
if (input.StartsWith("/"))
{
if (input.StartsWith("/bot"))
ProcessBotCommand(input);
if (input == "/save")
{
SaveBot();
continue;
}
}
var request = new Request(input, _user, _bot);
var response = _bot.Chat(request);
TellUser(response);
}
}
开发者ID:cberberian,项目名称:Brain,代码行数:26,代码来源:Program.cs
示例4: Main
static void Main(string[] args)
{
AIMLbot.Bot chatBot;
AIMLbot.User chatUser;
string channel = args[0];
string rnick = args[1];
string rmsg = args[2];
try
{
if (rmsg.StartsWith("!") == false)
{
string query = rmsg;
ObsidianFunctions.Functions ObsidFunc = new ObsidianFunctions.Functions();
chatBot = new AIMLbot.Bot();
chatBot.loadSettings();
chatUser = new AIMLbot.User(rnick, chatBot);
chatBot.loadAIMLFromFiles();
chatBot.isAcceptingUserInput = true;
AIMLbot.Request r = new AIMLbot.Request(query, chatUser, chatBot);
AIMLbot.Result res = chatBot.Chat(r);
Console.WriteLine("PRIVMSG " + rnick + " :" + res.Output);
}
}
catch (Exception ex)
{
Console.WriteLine("PRIVMSG " + rnick + " :" + ex.ToString());
}
}
开发者ID:ArkaneCow,项目名称:Obsidian,代码行数:28,代码来源:botchat.cs
示例5: Main
static void Main(string[] args)
{
string settingsPath = Path.Combine(Environment.CurrentDirectory, Path.Combine("config", "Settings.xml"));
Bot myBot = new Bot();
myBot.loadSettings(settingsPath);
User myUser = new User("consoleUser", myBot);
myBot.isAcceptingUserInput = false;
myBot.loadAIMLFromFiles();
myBot.isAcceptingUserInput = true;
while (true)
{
Console.Write("You: ");
string input = Console.ReadLine();
if (input.ToLower() == "quit")
{
break;
}
else
{
Request r = new Request(input, myUser, myBot);
Result res = myBot.Chat(r);
Console.WriteLine("Bot: " + res.Output);
}
}
}
开发者ID:VirusFree,项目名称:AIMLBot,代码行数:26,代码来源:Program.cs
示例6: getOutput
/// <summary>
/// Given an input string, return an output from the bot.
/// </summary>
/// <param name="input">string</param>
/// <param name="user">User (so conversations can be tracked by the bot, per user)</param>
/// <returns>string</returns>
public String getOutput(String input, User user)
{
Request r = new Request(input, user, this);
Result res = Chat(r);
return (res.Output);
}
开发者ID:RobIncAMDSPhD,项目名称:Gmail-Jabber-Chatbot,代码行数:13,代码来源:AIMLChatBot.cs
示例7: Chat
public string Chat(string input)
{
var request = new Request(input, this.user, this.bot);
var response = this.bot.Chat(request);
return response.Output;
}
开发者ID:nbusy,项目名称:nbusy-chatbot,代码行数:7,代码来源:ChatBot.cs
示例8: Result
/// <summary>
/// Ctor
/// </summary>
/// <param name="user">The user for whom this is a result</param>
/// <param name="bot">The bot providing the result</param>
/// <param name="request">The request that originated this result</param>
public Result(User user, Bot bot, Request request)
{
this.user = user;
this.bot = bot;
this.request = request;
this.request.result = this;
}
开发者ID:pi19404,项目名称:aimlbot-for-unity,代码行数:13,代码来源:Result.cs
示例9: getOutput
public String getOutput(String rawInput)
{
SpeechSynthesizer SpeechSynth = new SpeechSynthesizer();
Request request = new Request(rawInput, myUser, myBot);
Result result = myBot.Chat(request);
SpeechSynth.Speak(result.Output);
return (result.Output);
}
开发者ID:andrehendriks,项目名称:AutonomousComputerProgram-Missy,代码行数:8,代码来源:Missy.cs
示例10: setupMockObjects
public void setupMockObjects()
{
this.mockBot = new Bot();
this.mockUser = new User("1", this.mockBot);
this.mockRequest = new Request("This is a test", this.mockUser, this.mockBot);
this.mockQuery = new AIMLbot.Utils.SubQuery("This is a test <that> * <topic> *");
this.mockResult = new Result(this.mockUser, this.mockBot, this.mockRequest);
}
开发者ID:cberberian,项目名称:Brain,代码行数:8,代码来源:dateTagTests.cs
示例11: getoutput
public string getoutput(string Input)
{
SpeechLib.SpVoice synth = new SpeechLib.SpVoice();
Request request = new Request(Input, user, bot);
Result result = bot.Chat(request);
synth.Speak(result.Output, (SpeechVoiceSpeakFlags.SVSFDefault));
return(result.Output);
}
开发者ID:andrehendriks,项目名称:Missy-AutonomousComputerProgram,代码行数:8,代码来源:MainWindow.xaml.cs
示例12: getOutput
/// <summary>
/// This method takes an input string, then finds a response using the the AIMLbot library and returns it
/// </summary>
/// <param name="input">Input Text</param>
/// <returns>Response</returns>
public String getOutput(String input)
{
Request r = new Request(input, myUser, myBot);
Debug.Print("Request jest taki"+ r.ToString()+" "+ r.rawInput);
Result res=myBot.Chat(r);
Debug.Print("wynik" + res.ToString());
return(res.Output);
}
开发者ID:cucaracha8,项目名称:WFA-chatbot-init,代码行数:13,代码来源:alice.cs
示例13: Test
public void Test()
{
var bot = new Bot();
var user = new User("me", bot);
var request = new Request("test", user, bot);
var result = bot.Chat(request);
}
开发者ID:cberberian,项目名称:Brain,代码行数:8,代码来源:BotFixture.cs
示例14: setupMockObjects
public void setupMockObjects()
{
this.mockBot = new Bot();
this.mockBot.loadSettings();
this.mockBot.GlobalSettings.addSetting("timeout", "9999999999");
this.mockNode = new AIMLbot.Utils.Node();
this.mockRequest = new Request("Test 1", new User("1", this.mockBot), this.mockBot);
this.mockQuery = new AIMLbot.Utils.SubQuery("Test 1 <that> * <topic> *");
}
开发者ID:cberberian,项目名称:Brain,代码行数:9,代码来源:NodeTests.cs
示例15: ProcessCommand
public CommandResponse ProcessCommand(CommandRequest commandRequest)
{
var r = new Request(commandRequest.Command, _myUser, _myBot);
var res = _myBot.Chat(r);
var whatToDo = res.user.Predicates.grabSetting("whattodo");
var ret = _myBot.Chat(new Request("DO", _myUser, _myBot));
var processor = _commandProcessorFactory.GetCommandProcessor(commandRequest);
return processor.ProcessCommand(commandRequest);
}
开发者ID:cberberian,项目名称:Brain,代码行数:9,代码来源:CommandProcessor.cs
示例16: testEvaluateWithNoWildCards
public void testEvaluateWithNoWildCards()
{
string path = "Test 1 <that> that <topic> topic";
string template = "<srai>TEST</srai>";
this.mockNode = new AIMLbot.Utils.Node();
this.mockNode.addCategory(path, template, "filename");
this.mockRequest = new Request("Test 1", new User("1", this.mockBot), this.mockBot);
this.mockQuery = new AIMLbot.Utils.SubQuery(path);
Assert.AreEqual("<srai>TEST</srai>", this.mockNode.evaluate("Test 1 <that> that <topic> topic", this.mockQuery, this.mockRequest, AIMLbot.Utils.MatchState.UserInput, new StringBuilder()));
}
开发者ID:cberberian,项目名称:Brain,代码行数:10,代码来源:NodeTests.cs
示例17: setupMockObjects
public void setupMockObjects()
{
this.mockBot = new Bot();
this.mockUser = new User("1", this.mockBot);
this.mockRequest = new Request("This is a test", this.mockUser, this.mockBot);
this.mockQuery = new AIMLbot.Utils.SubQuery("This is a test <that> * <topic> *");
this.mockQuery.InputStar.Insert(0, "first star");
this.mockQuery.InputStar.Insert(0, "second star");
//this.mockResult = new Result(this.mockUser, this.mockBot, this.mockRequest);
}
开发者ID:cberberian,项目名称:Brain,代码行数:10,代码来源:thatTagTests.cs
示例18: button1_Click
private void button1_Click(object sender, EventArgs e)
{
var r = new Request(txtInputText.Text, _myUser, _myBot);
var res = _myBot.Chat(r);
textBox1.Text = res.Output;
if (checkBox1.Checked)
_synth.Speak(res.Output);
}
开发者ID:cberberian,项目名称:Brain,代码行数:10,代码来源:Form1.cs
示例19: Ask
public string Ask(string name, string question)
{
var sharpBot = new Bot();
sharpBot.loadSettings(SettingsPath);
var loader = new AIMLbot.Utils.AIMLLoader(sharpBot);
loader.loadAIML(aimlPath);
sharpBot.isAcceptingUserInput = false;
sharpBot.isAcceptingUserInput = true;
var patient = new User(name, sharpBot);
var request = new Request(question, patient, sharpBot);
var answer = sharpBot.Chat(request);
return answer.Output;
}
开发者ID:LeedsSharp,项目名称:DoctorSharp,代码行数:14,代码来源:DoctorSharp.cs
示例20: Chat
public string Chat(string userInput)
{
if (bot.isAcceptingUserInput)
{
Request newRequest = new Request(userInput, user, bot);
Result result = bot.Chat(newRequest);
lastRequest = newRequest;
lastResult = result;
return result.Output;
}
else {
return "I don't understand.";
}
}
开发者ID:edwinv710,项目名称:TalkingHead,代码行数:14,代码来源:ChatRobotOperator.cs
注:本文中的AIMLbot.Request类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论