聊天机器人要多大算力
⑴ 聊天机器人原理 要详细的
dotnet+xml开发简单聊天机器人 来源: http://blog.sina.com.cn/u/55fd做一个智能的聊天机器人并不容易,我这里只是实现了一个很简易的聊天机器人。 当你和这个机器人聊天的时候,每次机器人会根据你说的话的关键词找到回答的语句。如果找不到就随机的说一句默认语言。数据存储格式是xml。 以下是xml的原文件:<?xml version="1.0" encoding="UTF-8"?>
<chat>
<!--默认的聊天语句-->
<default>
<content>你在哪里?</content>
<content>你还是学生吗?</content> ......... </default>
<!--回答指定关键词的语句序列--><answer> <content key="怪"> 不怪</content>
<content key="慢">是啊,慢</content>
<content key="喂">什么事?</content>
<content key="88">再见</content>
<content key="谢">没什么好谢的</content>
<content key="滚">我不会滚,我会走</content>......<answer>
</chat>////////////////////////////////////////////////////////////////////以下是主要的源代码:Imports System.Xml
Public Class Form1
Inherits System.Windows.Forms.Form#Region " Windows 窗体设计器生成的代码 " Public Sub New()
MyBase.New() '该调用是 Windows 窗体设计器所必需的。
InitializeComponent() '在 InitializeComponent() 调用之后添加任何初始化 End Sub '窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub 'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer '注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'RichTextBox1
'
Me.RichTextBox1.Location = New System.Drawing.Point(0, 0)
Me.RichTextBox1.Name = "RichTextBox1"
Me.RichTextBox1.ReadOnly = True
Me.RichTextBox1.Size = New System.Drawing.Size(560, 304)
Me.RichTextBox1.TabIndex = 2
Me.RichTextBox1.Text = ""
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(0, 312)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(456, 21)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(472, 312)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 24)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Enter"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(560, 341)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.RichTextBox1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "青蛙王子"
Me.ResumeLayout(False) End Sub#End Region Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
readxml()
End Sub
Dim xmlFile As String = "./robot.xml"
Dim chatList As New ArrayList
Dim answerList As New Hashtable
Dim random As New System.Random Private Sub readxml()
Try
Dim doc As XmlDocument = New XmlDocument
doc.Load(xmlFile)
Dim nodeList As XmlNodeList
Dim root As XmlElement = doc.DocumentElement
'--默认的聊天语句--
nodeList = root.SelectNodes("/chat/default/content")
Dim node As XmlNode
For Each node In nodeList
chatList.Add(node.InnerText)
Next
'回答指定关键词的语句序列--
nodeList = root.SelectNodes("/chat/answer/content")
For Each node In nodeList
answerList.Add(node.Attributes("key").Value, node.InnerText)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'RichTextBox1.SelectionBullet = True
Dim Content$ = TextBox1.Text.Trim
If (Content = "") Then
RichTextBox1.AppendText("请不要欺骗我的感情,谢谢!" + ControlChars.Lf)
Exit Sub
End If
If (Content.IndexOf(":") <> -1) Then
If learnNewWord(Content) Then
RichTextBox1.AppendText("我又学会了新的东西,谢谢!" + ControlChars.Lf)
End If
Exit Sub
End If
RichTextBox1.AppendText(Content + ControlChars.Lf)
Dim aStr$ = getSimilarContent(Content)
If (aStr = Nothing) Then
Dim i% = random.Next(1, chatList.Count)
aStr = chatList.Item(i)
End If
RichTextBox1.AppendText(aStr.Trim + ControlChars.Lf)
RichTextBox1.Refresh()
End Sub
'得到相似的字符串
Function getSimilarContent(ByVal content As String) As String
Dim keys As System.Collections.ICollection = answerList.Keys
Dim enumR As System.Collections.IEnumerator = keys.GetEnumerator
While (enumR.MoveNext)
Dim str$ = enumR.Current
If content.Equals(str) Then
Return answerList(str)
End If
End While
enumR.Reset()
While (enumR.MoveNext)
Dim str$ = enumR.Current
If (content.IndexOf(str) <> -1) Or (str.IndexOf(content) <> -1) Then
Return answerList(str)
End If
End While
Return Nothing
End Function '添加新的语句
Function learnNewWord(ByVal content As String) As Boolean
Try
Dim doc As XmlDocument = New XmlDocument
Dim i% = content.IndexOf(":")
Dim str1$ = content.Substring(0, i)
Dim str2$ = content.Substring(i + 1)
doc.Load(xmlFile)
Dim elem As XmlElement = doc.CreateElement("content")
Dim attr As XmlAttribute = doc.CreateAttribute("key")
attr.Value = str1
elem.InnerText = str2
elem.Attributes.Append(attr)
'添加新的语句--
Dim root As XmlElement = doc.DocumentElement
Dim xmlNode As XmlNode = root.SelectSingleNode("/chat/answer")
xmlNode.AppendChild(elem)
answerList.Add(str1, str2)
doc.Save(xmlFile)
Return True
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar.Equals(ControlChars.Cr) Then
Button1_Click(Nothing, Nothing)
End If
End Sub
End Class
⑵ 谈了那么久的聊天机器人 好的机器人如何定义
满足你的使用功能的机器人,就是好的机器人。
所以,你说的好的机器人,先要看你对机器人需要哪些使用功能了。
⑶ 推荐一款聊天机器人。
语音助手很好玩
⑷ 关于智能聊天机器人目前最好的实现机制是不是使用AIML
给大量对话资源即可,没什么牛逼的算法和结构。
⑸ 聊天机器人要用多少内存
占5%的内存
⑹ 求微信聊天机器人
微信聊天机器人主要还是以图灵机器人为主,可以说是具有代表性的。那么其他的微信聊天人也有,比如聊天狗,它的智能聊天机器人就是一款可以提高群活跃度的功能。
⑺ 在手机上用什么聊天机器人比较好
在手机上用来聊天机器人很多,我觉得聊天小度机器人不错。
1.小度机器人能够通过自然的交互方式,依托强大的智能搜索技术,在准确理解用户意图的基础之上,与用户进行信息、服务、情感的交流。
2.小度机器人具有信息、服务、情感三大功能定位:借助网络强大的搜索引擎,不断学习各类知识,努力成为用户获取信息的最佳助手;小度机器人具备情感连接能力,能与用户进行感性互动,满足人类的情感与心理需求。
3.小度机器人有两种不同的形态:在互联网世界中,小度以虚拟的形态出现在网络网页搜索,网络儿童手机客户端及网络儿童ipad端上。
⑻ 聊天机器人的介绍
世界上最早的聊天机器人诞生于20世纪80年代,名为“阿尔贝特”,用BASIC语言编写而成。今天的互联网上,已出现“比利”、“艾丽斯”等聊天机器人等,中文的如“白丝魔理沙”、“乌贼娘”等由网友制作的聊天机器人。据悉,还有一个“约翰·列侬人工智能计划”,以再现当年“披头士”乐队主唱的风采为目标。1950年,图灵在哲学刊物《思维》上发表“计算机器与智能”的文章,提出了后来经典的图灵测试——交谈能检验智能,如果一台计算机能像人一样对话,它就能像人一样思考。他由此获称“人工智能之父”。1991年,美国科学家兼慈善家休·勒布纳设立人工智能年度比赛——勒布纳奖,号称是对图灵测试的第一种实践,旨在奖励最擅长模仿人类真实对话场景的机器人。2008年,勒布纳奖人工智能奖最后一轮10月12日在英国雷丁大学展开。艾尔博特等6种软件程序击败另外7种程序,获决赛资格。艾尔博特与12个陌生人交谈,力图让他们相信它是“人”。一番争论、笑声过后,这一电脑程序成功骗过3人,在今年人工智能比赛中拔得头筹,朝“成为史上第一台能思考的机器”目标更近一步。
⑼ 聊天机器人的成本大约是多少
30万!现在30万、还有没有高的,30万一次!
⑽ 一个聊天机器人如何实现盈利
在我看来聊天机器人主要有以下几种盈利方式:
为抑郁症患者、自闭症患者或者是渴望聊天解闷的人提供付费聊天服务;
开发如成语接龙、石头剪子布等功能付费使用;
以开包月会员的方式提供自动回复等服务,帮忙管理QQ群;
只要有足够的用户数,就能赚到钱。