And self.tweet

This commit is contained in:
Mispy 2014-04-18 23:37:25 -07:00
parent 29f46629ed
commit 7c12710482

View file

@ -113,12 +113,23 @@ STR
Archive.new(username, outpath).sync Archive.new(username, outpath).sync
end end
def self.tweet(modelpath, username) def self.tweet(modelpath, botname)
usage = <<STR
Usage: ebooks jsonify <old_corpus_path> [old_corpus_path2] [...]
Takes an old-style corpus of plain tweet text and converts it to json.
STR
if modelpath.nil? || botname.nil?
log usage
exit
end
load File.join(APP_PATH, 'bots.rb') load File.join(APP_PATH, 'bots.rb')
model = Model.load(modelpath) model = Model.load(modelpath)
statement = model.make_statement statement = model.make_statement
log "@#{username}: #{statement}" log "@#{botname}: #{statement}"
bot = Bot.get(username) bot = Bot.get(botname)
bot.configure bot.configure
bot.tweet(statement) bot.tweet(statement)
end end
@ -162,15 +173,16 @@ STR
end end
def self.command(args) def self.command(args)
usage = """Usage: usage = <<STR
Usage:
ebooks new <reponame> ebooks new <reponame>
ebooks consume <corpus_path> [corpus_path2] [...] ebooks consume <corpus_path> [corpus_path2] [...]
ebooks gen <model_path> [input] ebooks gen <model_path> [input]
ebooks score <model_path> <input> ebooks score <model_path> <input>
ebooks archive <@user> <outpath> ebooks archive <@user> <outpath>
ebooks tweet <model_path> <@bot> ebooks tweet <model_path> <botname>
ebooks jsonify <old_corpus_path> [old_corpus_path2] [...] ebooks jsonify <old_corpus_path> [old_corpus_path2] [...]
""" STR
if args.length == 0 if args.length == 0
log usage log usage