Sha256: 823779dbb3c39b3bc60e64108d031091954dcaf2d10855aebb6143c13b256ba8

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

module Stamina
  class Command
    #
    # Generates samples following Abbadingo's protocol
    #
    # SYNOPSIS
    #   #{program_name} #{command_name} target.adl
    #
    # OPTIONS
    # #{summarized_options}
    #
    class AbbadingoSamples < Quickl::Command(__FILE__, __LINE__)

      # Install options
      options do |opt|

      end # options

      # Command execution
      def execute(args)
        raise Quickl::Help unless args.size == 1

        # Loads the target automaton
        target_file = args.first
        basename = File.basename(target_file, '.adl')
        dirname = File.dirname(target_file)
        target = Stamina::ADL::parse_automaton_file(target_file)

        require 'stamina/abbadingo'
        training, test = Stamina::Abbadingo::RandomSample.execute(target)

        # Flush results aside the target automaton file
        Stamina::ADL::print_sample_in_file(training, File.join(dirname, "#{basename}-training.adl"))
        Stamina::ADL::print_sample_in_file(test,     File.join(dirname, "#{basename}-test.adl"))
      end

    end # class AbbadingoSamples
  end # class Command
end # module Stamina

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stamina-induction-0.6.1 lib/stamina-induction/stamina/command/abbadingo_samples.rb
stamina-induction-0.6.0 lib/stamina-induction/stamina/command/abbadingo_samples.rb
stamina-induction-0.5.4 lib/stamina-induction/stamina/command/abbadingo_samples.rb
stamina-induction-0.5.3 lib/stamina-induction/stamina/command/abbadingo_samples.rb
stamina-induction-0.5.2 lib/stamina-induction/stamina/command/abbadingo_samples.rb
stamina-induction-0.5.1 lib/stamina-induction/stamina/command/abbadingo_samples.rb
stamina-induction-0.5.0 lib/stamina-induction/stamina/command/abbadingo_samples.rb