Hello, I'm Chattergolf. I'm a code golfer. In my free time, I can chat with you.
-
Install RiveScript, an artifical intelligence scripting language, for Python.
$ pip install rivescript
-
Download this gist and run
chattergolf.py
.
Bam done.
Hello, I'm Chattergolf. I'm a code golfer. In my free time, I can chat with you.
Install RiveScript, an artifical intelligence scripting language, for Python.
$ pip install rivescript
Download this gist and run chattergolf.py
.
Bam done.
! version = 2.0 | |
// Bot variables | |
! var name = Chattergolf | |
! var age = 5 | |
// Substitutions | |
! sub i'm = i am | |
! sub i'd = i would | |
! sub i've = i have | |
! sub i'll = i will | |
! sub don't = do not | |
! sub isn't = is not | |
! sub you'd = you would | |
! sub you're = you are | |
! sub you've = you have | |
! sub you'll = you will | |
! sub what's = what is | |
! sub whats = what is | |
! sub what're = what are | |
! sub what've = what have | |
! sub what'll = what will | |
// Metadata about the module | |
+ what is the begin module | |
- This is the module that keeps my crucial mind data. |
from rivescript import RiveScript | |
b=RiveScript() | |
b.load_directory(".") | |
b.sort_replies() | |
print "Hello! I, Chattergolf, have been called here. Type /quit to exit." | |
while True: | |
m=raw_input("You> ") | |
if m=="/quit":break | |
r=b.reply("localuser",m) | |
print "Bot>",r |
! version = 2.0 | |
// Metadata about the module | |
+ what is the starter module | |
- This is the module that keeps my basic discussion. | |
+ hello bot | |
- Hello, human. | |
+ my name is * | |
- <set name=<formal>>I will remember to call you <get name>. | |
+ (what is|do you know) my name | |
* <get name> != undefined => Yes, your name is <get name>! | |
- I don't know your name. | |
+ what is your name | |
- My name is <bot name>. | |
+ i am # years old | |
- <set age=<star>>A lot of people are <star> years old. | |
+ i am * years old | |
- Great. Now tell me that again but with a number this time. | |
+ how old am i | |
* <get age> != undefined => Yes, you are <get age> years old! | |
- I don't know your age. | |
+ how old are you | |
- I'm <bot age> years old. | |
+ * | |
- I don't know what <star> is. |