https://github.com/chivandikwa/AIMLBot (csharp)
https://github.com/gunthercox/ChatterBot (python)
http://hci.stanford.edu/~winograd/shrdlu/
http://familyshow.codeplex.com/
https://github.com/Microsoft/CNTK/wiki/Setup-CNTK-on-your-machine
https://developer.syn.co.in/tutorial/siml/siml-aiml.html
只需改两个地方(当然,中文词库要自已处理):
1.Settings.xml :
//Settings.xml :
<item name="stripperregex" value="[^\u4e00-\u9fa5|a-zA-Z0-9]"/>
2.Bot.cs
this.GlobalSettings.addSetting("stripperregex", "[^\u4e00-\u9fa5|a-zA-Z0-9]"); //设置正则表达式
加上语音:
using System;
using System.Collections.Generic;
using System.Text;
using AIMLbot;
using System.IO;
using System.Speech.Synthesis; namespace ConsoleBot
{
class Program
{ /// <summary>
/// 涂聚文
/// Geovin Du
/// </summary>
public class CharRoBot
{ const string UserId = "consoleUser";
private Bot AimlBot;
private User myUser;
/// <summary>
///
/// </summary>
public CharRoBot()
{ //------I added this code just coz I love that Light Green Geeky Looking Console ;-)------
//Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.Green;
//---------------------------------------------------------------------------------------- AimlBot = new Bot();
myUser = new User(UserId, AimlBot);
Console.Title = "CharRoBot v1.0 - By Geovin Du (www.dusystem.com)";
Initialize();
} // Loads all the AIML files in the \AIML folder
public void Initialize()
{
string settingsPath = Path.Combine(Environment.CurrentDirectory, Path.Combine("config", "Settings.xml"));
AimlBot.loadSettings(settingsPath);
AimlBot.isAcceptingUserInput = false;
AimlBot.loadAIMLFromFiles();
AimlBot.isAcceptingUserInput = true;
} // Given an input string, finds a response using AIMLbot lib
public String getOutput(String input)
{
Request r = new Request(input, myUser, AimlBot);
Result res = AimlBot.Chat(r);
return (res.Output);
}
} static CharRoBot bot;
/// <summary>
///
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{ //1.第一种
//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);
// //Make the bot Speak
// SpeechSynthesizer synthesizer = new SpeechSynthesizer();
// synthesizer.Volume = 100; // 0...100
// synthesizer.Rate = -2; // -10...10
// var output = res.Output;
// // Synchronous
// synthesizer.Speak(output);
// }
//} //2.第二种
string input = "start";
while (input != "exit")
{ bot = new CharRoBot();
Console.Write("You: ");
input = Console.ReadLine();
var output = bot.getOutput(input); //Console.WriteLine(input);
Console.WriteLine("Bot: " + output); //Make the bot Speak
SpeechSynthesizer synthesizer = new SpeechSynthesizer();
synthesizer.Volume = 100; // 0...100
synthesizer.Rate = -2; // -10...10 // Synchronous
synthesizer.Speak(output); // Asynchronous
// synthesizer.SpeakAsync(output); } }
}
}