Categories

Versions

Replace (In Database) (In-Database Processing)

Synopsis

This operator replaces parts of the values of nominal attributes.

Description

This operator replaces parts of the string values of all nominal attributes it is applied on. The attribute filter type gives the possibility to restrict them. For each value of each attribute it is checked if the regular expression of replace what matches the string. Each matching part of the string will be replaced by the value of the replace_what parameter. The replacement might be empty and can contain capturing groups.

Please keep in mind that certain databases may not support regular expressions, in that case a design-time warning will appear if special characters are used. Also note that regular expressions may differ between different database engines. Please consult the documentation of your database regarding more complicated examples.

Note that the output data type for the columns with replaced values may depend on your database (e.g. LONGTEXT in case of MySQL that becomes Text in RapidMiner). In other cases, the replace expression may cause that the value becomes too large for the default return data type, in which case the result may be erroneous (e.g. max 4000 characters in Oracle).

Examples The attribute contains the values "color red", "color green" and "color blue".

  • replacing "color" by "" yields: " red", " green", " blue"
  • replacing "color" by "colour" yields: "colour red", "colour green", "colour blue"
  • replacing "color\s" by "" yields: "red", "green", "blue"
  • replacing "\s+" by "_" yields: "color_red", "color_green", "color_blue"

Input

  • example set input

Output

  • example set output

Parameters

  • attribute_filter_type The condition specifies which attributes are selected or affected by this operator. Range: selection
  • attribute The attribute which should be chosen. Range: string
  • attributes The attribute which should be chosen. Range: string
  • regular_expression A regular expression for the names of the attributes which should be kept. Range: string
  • use_except_expression If enabled, an exception to the specified regular expression might be specified. Attributes of matching this will be filtered out, although matching the first expression. Range: boolean
  • except_regular_expression A regular expression for the names of the attributes which should be filtered out although matching the above regular expression. Range: string
  • value_type The value type of the attributes. Range: selection
  • use_value_type_exception If enabled, an exception to the specified value type might be specified. Attributes of this type will be filtered out, although matching the first specified type. Range: boolean
  • except_value_type Except this value type. Range: selection
  • block_type The block type of the attributes. Range: selection
  • use_block_type_exception If enabled, an exception to the specified block type might be specified. Range: boolean
  • except_block_type Except this block type. Range: selection
  • numeric_condition Parameter string for the condition, e.g. '>= 5' Range: string
  • invert_selection Indicates if only attributes should be accepted which would normally filtered. Range: boolean
  • replace_what A regular expression specifying what should be replaced. Range: string
  • replace_by The replacement for the region matched by the regular expression. Possibly including capturing groups. Range: string