Created
November 27, 2012 02:01
-
-
Save adhown/4151926 to your computer and use it in GitHub Desktop.
Learning ruby basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
bot_data = { | |
:presubs => [ | |
["dont", "dont"], | |
["youre", "you're"], | |
["love", "like"] | |
], | |
:responses => { | |
:default => [ | |
"I don't understand.", | |
"what?", | |
"Huhhh bete?" | |
], | |
:greeting => ["Hi. I'm [name]. Want to chat?"], | |
:farewell => ["Good bye!"] | |
'hello' => [ | |
"How's it going?", | |
"How do you do?" | |
], | |
'i like *' => [ | |
"Why do you like *?", | |
"Wow I like * too!" | |
] | |
} | |
} | |
#Menampilkan struktur user dengan yaml | |
# | |
puts bot_data.to_yaml | |
#Write the yaml data to file | |
f = File.open(ARGV.first || 'bot_data', "w") | |
f.puts bot_data.to_yaml | |
f.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated version here: GitHub Gist - Pysis868/bot_data_to_yaml.rb