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文本处理——中文标点符号处理
中文文本中可能出现的标点符号来源比较复杂,通过匹配等手段对他们处理的时候需要格外小心,防止遗漏.以下为在下处理中文标点的时候采用的两种方法,如有更好的工具,请推荐补充. 中文标点集合 比较常见标点有这 ...
随机推荐
- Yii2 三层设计模式:SQL Command、Query builder、Active Record(ORM)
用Yii2也有一段时间了,发现Yii2 Framework对Database的操作有非常良好的结构和弹性. 接下来介绍三种数据库操作方式. SQL Command Level: // Get DB c ...
- 10.TreeSet、比较器
Comparable和Comparator Comparable 简介 Comparable 是排序接口.若一个类实现了Comparable接口,就意味着"该类支持排序". 即 ...
- HTTP 协议支持的十种方法
GET 获取资源,用来请求访问已被URI识别的资源. POST 传输实体主体. PUT 传输文件,(鉴于HTTP/1.1的PUT方法自身不带验证机制,任何人都可以上传文件,存在安全性问题,因此一般We ...
- JavaScript 函数式编程读书笔记1
概述 这是我读<javascript函数式编程>的读书笔记,供以后开发时参考,相信对其他人也有用. 说明:虽然本书是基于underscore.js库写的,但是其中的理念和思考方式都讲的很好 ...
- Failed to acquire lock on file .lock in /tmp/kafka-logs. A Kafka instance in another process or thread is using this directory.
1. 问题现象 启动 kafka 时报错:Failed to acquire lock on file .lock in /tmp/kafka-logs. A Kafka instance in an ...
- Testing - 软件测试知识汇总
软件测试知识梳理 基础概念 : http://www.cnblogs.com/anliven/p/6070000.html 测试分类 : http://www.cnblogs.com/anliven/ ...
- DevOps - CI - 持续集成(Continuous Integration)
初见 持续集成是什么? 持续集成基础概念介绍 持续集成服务器与工具集 了解 敏捷开发中的持续集成 使用Jenkins进行持续集成 案例 gitlab+gerrit+jenkins持续集成框架 使用Ge ...
- .NET手记-友盟消息推送服务器端加密算法的实现
最近为App开发消息推送功能,这里我们采用了友盟的消息推送服务,但其后台简陋,可定制化程度低,所以决定接入服务器端API,在自己的服务器上部署一套推送服务. 其中涉及到很多问题,首先要解决的就是与友盟 ...
- Devops流程规范
芯盾时代_Devops_Docker操作说明及使用规范 北京芯盾时代科技有限公司 2019年1月 修订记录 版本号 修订人 修订日期 修订描述 v0.1 芯盾 2019/1/15 初次创建 v0.2 ...
- MyBatis 分页之拦截器实现
分页是WEB程序中常见的功能,mybatis分页实现与hibernate不同,相比hibernate,mybatis实现分页更为麻烦.mybatis实现分页需要自己编写(非逻辑分页RowBounds) ...