Sha256: 0ee7bb4b884a27fd7ef8b5226ad36fe2e88bb0c216d840d67a555f66f9441453

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

require_relative 'simple'
module Preprocessor
  #
  # Preprocessor Base Class
  #
  # @author Andreas Eger
  #
  class IDMapping < Simple
    attr_reader :id_map

    #
    # @param  args [Hash] options hash
    # @option args [Hash] :industry_map mapping for the tree like industry ids to continuous ones
    def initialize id_map, args={}
      super(args)
      @id_map = id_map
    end

    def map_id(id)
      @id_map[id]
    end
    def label
      "with_id_mapping"
    end

    private
    def process_job job
      PreprocessedData.new(
        data: [clean_title(job[:title]), clean_description(job[:description])],
        id: map_id(job[:id]),
        label: job[:label]
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
svm_helper-0.2.1 lib/svm_helper/preprocessors/id_mapping.rb
svm_helper-0.1.1 lib/svm_helper/preprocessors/id_mapping.rb