AIMLBot (中文自动回复)文本自动回复机器人
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); } }
}
}
AIMLBot (中文自动回复)文本自动回复机器人的更多相关文章
- 微信的自动回复&接入聊天机器人
今天偶尔发现了一个有趣的python库--itchat,可以实现微信的自动回复.防撤回,结合图灵机器人还能实现聊天机器人的作用 简单介绍一下配置与工具 win7旗舰版 pycharm python ...
- PHP微信关注自动回复文本消息。
服务器配置URL默认接受 $_GET["echostr"] 配置成功. public function GetShow(){ $token = $this->token; / ...
- 利用人工智能(Magpie开源库)给一段中文的文本内容进行分类打标签
当下人工智能是真心的火热呀,各种原来传统的业务也都在尝试用人工智能技术来处理,以此来节省人工成本,提高生产效率.既然有这么火的利器,那么我们就先来简单认识下什么是人工智能吧,人工智能是指利用语音识别. ...
- [dx11]利用SpriteFont绘制中文--本地化文本
1.下载DirectX11 Tool Kit SDK,解压后编译,生成DirectXTK.lib库文件和MakeSpriteFont应用工具; 2.在Dx11环境基础上,用生成的库文件搭建XTK环境; ...
- Python itchat模块的使用,利用图灵机器人进行微信消息自动回复
一.下载安装itchat模块 二.小实验:获取微信好友头像信息 这需要用itchat模块中的一个方法 itchat.get_friends()#获取微信所有微信好友信息 现在我们导入itchat,打印 ...
- 【chrome插件】web版微信接入图灵机器人API实现自动回复
小贱鸡自动回复API已经不可以用了,现在改良接入图灵机器人API 360chrome浏览器团队翻译了部分谷歌插件开发文档 地址:http://open.chrome.360.cn/extension_ ...
- 自动回复消息-微信公众平台开发4(asp.net)
接着上一节的processRequest 处理函数,代码如下: /// <summary> /// 处理微信发来的请求 /// </summary> /// ...
- 微信公众号自动回复 node
纯属分享记录: app.js var bodyParser = require('body-parser'); require('body-parser-xml')(bodyParser); var ...
- Python文本处理——中文标点符号处理
中文文本中可能出现的标点符号来源比较复杂,通过匹配等手段对他们处理的时候需要格外小心,防止遗漏.以下为在下处理中文标点的时候采用的两种方法,如有更好的工具,请推荐补充. 中文标点集合 比较常见标点有这 ...
随机推荐
- bash编程-条件测试
Shell脚本中经常需要判断某情况或者数据是否满足,需要由测试机制来实现. 测试方式 echo $?查看命令执行状态返回值 bash脚本中可以自定义返回值exit n(n为自己指定的状态码),shel ...
- Spring AOP的实现及源码解析
在介绍AOP之前,想必很多人都听说AOP是基于动态代理和反射来实现的,那么在看AOP之前,你需要弄懂什么是动态代理和反射及它们又是如何实现的. 想了解JDK的动态代理及反射的实现和源码分析,请参见下面 ...
- 使用config 来管理ssh的会话
通常利用 ssh 连接远程服务器,一般都要输入以下类型命令: ssh user@hostname -p port 如果拥有多个ssh账号,特别是像我这种喜欢在终端里直接ssh登录, 要记住每个ssh账 ...
- Tools - Windows OS
001 - 文本操作 Ctrl + C / Ctrl + V / Ctrl + X / Ctrl + Z / Ctrl + A:复制/粘贴/剪贴/撤销/全选. 002 - 窗口分屏 使用快捷键 选中程 ...
- postgresql-排序
postgresql的排序. https://www.cnblogs.com/flying-tiger/p/8120046.html 1.是根据排序数据量的大小来判断,如果数据量少到能够整体放到内存的 ...
- 30-socketserver类
SocketServer模块简化了编写网络服务程序的任务.同时SocketServer模块也是Python标准库中很多服务器框架的基础. socketserver模块可以简化网络服务器的编写,Pyth ...
- 深入理解css3中 nth-child 和 nth-of-type 的区别
在css3中有两个新的选择器可以选择父元素下对应的子元素,一个是:nth-child 另一个是:nth-of-type. 但是它们到底有什么区别呢? 其实区别很简单::nth-of-type为什么要叫 ...
- Hive的union和join操作
建表语句: create table tb_in_base ( id bigint, devid bigint, devname string ) partitioned b ...
- docker+nginx实现负载均衡
配置nginx配置文件(配置文件运行时是会加载到docker进程中)先建立nginx相关文件和目录,对应下面启动命令中的挂载位置,把主配置文件nginx.conf放到对应位置“/etc/docker/ ...
- MySQL 设计规范
一.数据库命令规范 所有数据库对象名称必须使用小写字母并用下划线分割 所有数据库对象名称禁止使用mysql保留关键字(如果表名中包含关键字查询时,需要将其用单引号括起来) 数据库对象的命名要能做到见名 ...