Class: Preprocessor::IDMapping

Inherits:
Simple
  • Object
show all
Defined in:
lib/svm_helper/preprocessors/id_mapping.rb

Overview

Preprocessor Base Class

Author:

  • Andreas Eger

Constant Summary

Constants inherited from Simple

Simple::CODE_TOKEN_FILTER, Simple::EMAIL_FILTER, Simple::GENDER_FILTER, Simple::NEW_LINES, Simple::STOPWORD_LOCATION, Simple::SYMBOL_FILTER, Simple::URL_FILTER, Simple::WHITESPACE, Simple::WORDS_IN_BRACKETS, Simple::XML_TAG_FILTER

Constants included from ParallelHelper

ParallelHelper::THREAD_COUNT

Instance Attribute Summary collapse

Attributes inherited from Simple

#language

Instance Method Summary collapse

Methods inherited from Simple

#clean_description, #clean_title, #process, #strip_stopwords

Methods included from ParallelHelper

#p_map, #p_map_with_index, #parallel?

Constructor Details

#initialize(id_map, args = {}) ⇒ IDMapping

Returns a new instance of IDMapping.

Parameters:

  • args (Hash) (defaults to: {})

    options hash

Options Hash (args):

  • :industry_map (Hash)

    mapping for the tree like industry ids to continuous ones



14
15
16
17
# File 'lib/svm_helper/preprocessors/id_mapping.rb', line 14

def initialize id_map, args={}
  super(args)
  @id_map = id_map
end

Instance Attribute Details

#id_mapObject (readonly)

Returns the value of attribute id_map.



9
10
11
# File 'lib/svm_helper/preprocessors/id_mapping.rb', line 9

def id_map
  @id_map
end

Instance Method Details

#labelObject



22
23
24
# File 'lib/svm_helper/preprocessors/id_mapping.rb', line 22

def label
  "with_id_mapping"
end

#map_id(id) ⇒ Object



19
20
21
# File 'lib/svm_helper/preprocessors/id_mapping.rb', line 19

def map_id(id)
  @id_map[id]
end