Class: PokemonNameGenerator::CLI::Commands::Generate

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/pokemon_name_generator/cli/commands.rb

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/pokemon_name_generator/cli/commands.rb', line 26

def call(**options)
  corpus = Corpus.new

  algorithm = case options.fetch(:algorithm)
  when "naive" then Naive.new(corpus.pokemon_phonemes)
  when "markov" then Markov.new(corpus.pokemon_phonemes, context_length: options.fetch(:context).to_i)
  end

  options.fetch(:number).to_i.times { puts algorithm.generate_name }
end