megahal
1.0.0
MegaHAL 是一个学习聊天机器人。
您可以将其作为命令行应用程序运行,或者将其嵌入到您自己的应用程序中并通过简单的 API 进行调用。例如,请参阅 megahal-server 存储库,它允许您与 MegaHAL 在线聊天。
它建立在 Sooth 之上,Sooth 是一个简单的随机预测模型。
MegaHAL 的新版本是为了向我大约二十年前编写的原版致敬而编写的。随着这些事情的发展,Ruby 版本的大小只是原始 C 版本的一小部分。
我对 MegaHAL 的最早记录是 1995 年 4 月 30 日的 USENET 帖子,该帖子转载于本 README 的底部。
运行 MegaHAL 的命令行版本很简单:
> gem install megahal
> megahal
+----------------------------------------------------------+
| |
| # # ###### #### ## # # ## # |
| ## ## # # # # # # # # # # |
| # ## # ##### # # # ###### # # # |
| # # # # ### ###### # # ###### # |
| # # # # # # # # # # # # |
| # # ###### #### # # # # # # ###### |
| |
| Type "/help" for options and "/quit" to terminate. |
+----------------------------------------------------------+
Greetings and salutations to thee and thine.
>
如果您在提示符下输入/help
,您将看到一个菜单:
1. cancel
2. reset
3. brain
4. train
5. load
6. save
7. ignore
8. quit
通过键入菜单项的编号或名称进行选择:
cancel
:返回而不进行选择reset
:清除MegaHAL的大脑,将其恢复为空白brain
:从许多现有的性格中进行选择(见下文)train
:给 MegaHAL 一个纯文本文件供学习load
:从文件中加载之前保存的大脑save
: 将当前MegaHAL大脑保存到文件中ignore
:阻止 MegaHAL 从用户输入中学习;如果你想在不改变大脑的情况下聊天,这很好quit
:立即退出 MegaHAL,丢失所有未保存的更改如果您选择上面的brain
菜单项,您将看到一个预先存在的 MegaHAL 大脑列表供您选择:
cancel
:返回而不进行选择default
:1998 年 Loebner 比赛使用的个性aliens
:来自外星人的主教!ferris
:费里斯·布勒先生本人!布勒!布勒!pepys
:Samuel Pepys,取自 @samuelpepys Twitter feedpulp
:《低俗小说》中的马塞勒斯·华莱士!sherlock
:夏洛克·福尔摩斯,引用自所有书籍startrek
:来自《星际迷航》的数据(感谢 mbaker)starwars
:星球大战三部曲中的 Threepio! 以下是直接取自megahal.log
文件的示例对话记录(每次与 MegaHAL 交互时都会写入该文件):
(brain changed to sherlock holmes)
MH10: On the strange coincidences, the plannings, the cross-purposes, the wonderful chains of events, working through generations, and leading to the composition of a woman.
USER: Who are you?
MH10: You could never guess how I employed my morning, or what I ended by doing.
USER: Did you play a game?
MH10: Come, Watson, come! The game is afoot.
USER: How exciting!
MH10: Isn't it gorgeous! What do you think of it.
USER: I think it's great. What are we going to do?
MH10: I think, perhaps, it is simplicity itself.
USER: Tell me then.
MH10: Your statement is, I want you?
USER: Ummm... no.
MH10: Yes, certainly.
USER: I think you're confused.
MH10: I think that you have been too busy to think of it.
USER: Are you saying what I think you're saying?
MH10: You know how to look into it.
USER: So do you by the sound of it.
MH10: I have been of material assistance to me for fifty minutes.
USER: Is this non-stop double entendre?
MH10: More than that it is a great thing for me to be able to understand that I have ever listened.
USER: Let's go and do something. Or get a bite to eat.
MH10: That is interesting.
USER: Why?
MH10: Because there are fifty who can reason analytically.
USER: Name them.
MH10: My name is Sherlock Holmes.
USER: And who are the other forty-nine?
MH10: I want to ascertain.
USER: You mean that you don't know?
MH10: Light a cigar and let me see if I can do what you have told me I think that both inferences are permissible.
USER: Well, it's been interesting. I must leave.
MH10: No crime, but a very interesting statement.
USER: Goodbye.
MH10: You must get home instantly and act.
MegaHAL Stopped
Have a weird conversation with a computer
-----------------------------------------
Recently I added a feature to my home page allowing the user to "talk" to a
computer program of mine. The program was not written very intelligently, so
most of the time its replies consisted of incoherent babble.
Version 2 came and went, and now version 3 - MegaHAL - is ready for release.
The new features of the program are:-
* A second-order markov model is used, and it is doubly-linked. This
means that the computers sentences tend to be more grammatical.
* Punctuation is supported, which segments the sentences realistically.
* The reply given by the computer is based upon one of the words in
the input string. The word selected is one that maximises the ratio
(number of times since word was last used)/(number of times word has
appeared).
* The computers reply is generated from this keyword, and may be up to
100 words long. The reply is generated in such a way that it is
impossible to get stuck in infinite loops.
* The keyword used is highlighted in the reply.
Some example conversations are given below:-
USER: you are crazy
HAL: WE *ARE* WEIRD.
USER: What is the meaning of life oh wise one?
HAL: *LIFE* IS THE ROOM.
USER: this is not getting us very far
HAL: YES I AM *GETTING* BORED OF GLOBAL DOMINATION.
USER: I have no idea.
HAL: *NO* IT IS IN HEAVEN.
USER: Is it really?
HAL: YES *IT* IS.
USER: My name is Jason.
HAL: I THINK ALAN TURING WAS A GIRLIE, JUST LIKE *MY* DEAR MAMA
The last response was generated from a combination of a discussion
about Alan Turing, and Monty Python's Lumberjack Song. Surely this
must be a sign of intelligence ;^)
Have fun!
版权所有 (c) 2018 贾森·哈钦斯。有关更多详细信息,请参阅“UNLICENSE”。