Make model dir on consume if not exist

Fixes #93
This commit is contained in:
Jaiden Mispy 2015-11-02 17:10:30 -08:00
parent 8a67a69649
commit 05f47d4bd0

View file

@ -93,7 +93,9 @@ STR
filename = File.basename(path) filename = File.basename(path)
shortname = filename.split('.')[0..-2].join('.') shortname = filename.split('.')[0..-2].join('.')
FileUtils.mkdir_p(File.join(APP_PATH, 'model'))
outpath = File.join(APP_PATH, 'model', "#{shortname}.model") outpath = File.join(APP_PATH, 'model', "#{shortname}.model")
Ebooks::Model.consume(path).save(outpath) Ebooks::Model.consume(path).save(outpath)
log "Corpus consumed to #{outpath}" log "Corpus consumed to #{outpath}"
end end
@ -120,7 +122,7 @@ STR
HELP.append = <<-STR HELP.append = <<-STR
Usage: ebooks append <model_name> <corpus_path> Usage: ebooks append <model_name> <corpus_path>
Process then append the provided corpus to the model Process then append the provided corpus to the model
instead of overwriting. instead of overwriting.
STR STR
@ -133,7 +135,7 @@ STR
Ebooks::Model.consume(path).append(File.join(APP_PATH,'model',"#{name}.model")) Ebooks::Model.consume(path).append(File.join(APP_PATH,'model',"#{name}.model"))
log "Corpus appended to #{name}.model" log "Corpus appended to #{name}.model"
end end
HELP.jsonify = <<-STR HELP.jsonify = <<-STR
Usage: ebooks jsonify <tweets.csv> [tweets.csv2] [...] Usage: ebooks jsonify <tweets.csv> [tweets.csv2] [...]
@ -300,7 +302,7 @@ STR
Shows you twitter_ebooks' version number. Shows you twitter_ebooks' version number.
STR STR
def self.version def self.version
require File.expand_path('../../lib/twitter_ebooks/version', __FILE__) require File.expand_path('../../lib/twitter_ebooks/version', __FILE__)
log Ebooks::VERSION log Ebooks::VERSION