Module: BatchExperiment::UKP5Extractor

Extended by:
Extractor
Defined in:
lib/batch_experiment/sample_extractors.rb

Overview

Extractor for the output of the run_ukp5.out program available at github.com/henriquebecker91/masters. Not of interest for the majority of the users of this gem. Kept as example, and for this gem author personal use.

Class Method Summary collapse

Methods included from Extractor

extract, extract_from_lines, get_field, get_hfield, names

Class Method Details

.extract_from_lines(lines) ⇒ Array<String>

Optionally, you can define this method instead of #extract. The #extract method will call this method if not overrided.

Parameters:

  • lines (Array<String>)

    Program output, broken in lines, and the line string elements don’t end in linebreak.

Returns:

  • (Array<String>)

    The N extracted values, as strings.



40
41
42
43
44
# File 'lib/batch_experiment/sample_extractors.rb', line 40

def self.extract_from_lines(lines)
  ['Seconds', 'ext_time', 'ext_mem', 'opt'].map do | label |
    Extractor.get_field(lines, label)
  end
end

.namesArray<String>

Note:

To be on the safe side you should create a new array at each call. If you always return a reference to the same array the array can be modified.

Return the field names for each of the elements returned by extract. Ex.:

['Time', 'Max Mem Use', 'opt', ... ]

Returns:

  • (Array<String>)

    The strings that will be used to make the column names at the BatchExperiment.experiment method.



35
36
37
# File 'lib/batch_experiment/sample_extractors.rb', line 35

def self.names
  ['internal_time', 'external_time', 'external_memory', 'opt']
end