Megahal is a conversation simulator, free software, available as a package in Debian systems. This post will talk about how to use and train it. Not difficult, but the first time I was a bit confused.
First of all: install megahal:
apt-get install megahal
(or aptitude, compile from the source, etc.).
Then you can run megahal in the terminal, just typing megahal. It will probably show something like:
carles@pinux:~$ megahal
+----------------------------
MEGAHAL BANNER
| Copyright(C) 1998 Jason Hutchens
+----------------------------
MegaHAL emitted a warning; check the error log.
Unable to find the personality /home/carles/.megahal/megahal.trn
I don't know enough to answer you yet!
>
Megahal, before talking, needs to learn a bit (so it’s not useful yet). The way that Megahal works (see How Megahal works for a better detail) is learning which words are likely to appear after some other words. So, after the word “hello” maybe appears “how” 80% of the time. Megahal uses a Markov modeling of 4th-order, so it “guesses” the 5th word after 4 words (or the preceding word).
When talking with Megahal: one “Enter” is just a new line, two enters is to “send” the text to Megahal. E.g.:
> Hello,
> how are you?
>
I don't know enough to answer you yet!
>
When you want to exit you can type #quit and two enters:
> #quit
>
Saving tree: 100%
Saving tree: 100%
Saving dictionary: 100%
carles@pinux:~$
Do you want more fun? I like to feed Megahal with real conversations. So I got my Jabber logs, processed to one line per message (Kopete saves it in XML format) and then I used the Python script that generates the files that Megahal can use for speaking. Something like:
carles@pinux:~/megahalLearn$ rm -rf ~/.megahal #WARNING: will delete existing knowledge of Megahal
carles@pinux:~/megahalLearn$ mkdir ~/.megahal
carles@pinux:~/megahalLearn$ python /usr/share/doc/megahal/examples/quick-learn.py < txt.txt # generates the megahal files in the current directory
+----------------------------
MEGAHAL BANNER
| Copyright(C) 1998 Jason Hutchens
+----------------------------
MegaHAL emitted a warning; check the error log.
Unable to find the personality ./megahal.trn
Saving tree: 100%
Saving tree: 100%
Saving dictionary: 100%
carles@pinux:~/megahalLearn$ mv megahal.brn megahal.dic megahal.log megahal.txt ~/.megahal # move the generated files to ~/.megahal
carles@pinux:~/megahalLearn$ megahal -b #-b to not have the banner
Loading tree: 100%
Loading tree: 100%
Loading dictionary: 100%
Remind me in the eyes of some users who enabled this easter egg option,
watch for certain events in their sources of inspiration for writing
(taylor, 1990.
>
> How are you today?
>
Are you at the same user account than mac os x but not in today.
(Remember the double-enter!)
We can teach Megahal with different files: IRC logs? Jabber/XMPP? Mails? Wikipedia? And then have some talks.
Megahal, apart of being fun, is a good system to create a chatbot 🙂
[…] pintant… amb teclat qwerty « Megahal: how to use it? […]