class EnterRockstar::CLI
command line interface for enter-rockstar command
Public Instance Methods
poetic(number, source_json)
click to toggle source
# File lib/enter_rockstar/cli.rb, line 43 def poetic(number, source_json) amount = options[:amount] || 5 strategy = options[:strategy] || 'random' generator = EnterRockstar::Generator::Poetic.new(data_file: source_json, amount: amount, strategy: strategy) results = generator.number(number) say results.join("\n") end
print_indexed_tree(category_name)
click to toggle source
# File lib/enter_rockstar/cli.rb, line 27 def print_indexed_tree(category_name) scraper = EnterRockstar::Scraper::Wikia.new(category_name: category_name) scraper.load_saved_json scraper.print_indexed_tree end
scrape_category(category_name, url)
click to toggle source
# File lib/enter_rockstar/cli.rb, line 12 def scrape_category(category_name, url) scraper = EnterRockstar::Scraper::Wikia.new(category_name: category_name, url: url) scraper.parse_category scraper.save_category say end
scrape_lyrics(category_name, start_index = 0)
click to toggle source
# File lib/enter_rockstar/cli.rb, line 20 def scrape_lyrics(category_name, start_index = 0) scraper = EnterRockstar::Scraper::Wikia.new(category_name: category_name) scraper.load_saved_json scraper.parse_all_pages(start_index: start_index) end
tokenize(name, data_dir)
click to toggle source
# File lib/enter_rockstar/cli.rb, line 34 def tokenize(name, data_dir) tokenizer = EnterRockstar::Corpus::Tokenizer.new(data_dir: data_dir, name: name) tokenizer.tokenize tokenizer.save_all end