The following node is available in the Open Source KNIME predictive analytics and data mining platform version 2.7.1. Discover over 1000 other nodes, as well as enterprise functionality at http://knime.com.

String Replace (Dictionary)

This node replaces the cells in a selected column by elements of a dictionary. The cell is compared against the keys in the dictionary file and - given that a matching key is found - the cell content is then replaced by the value of the respective dictionary entry.

The dictionary must be plain text file, whereas rows in the file correspond to entries in a dictionary. Each line should be of the format

    value, key1, key2, key3, ...

The value string corresponds to the replacement string (matching keys are replaced with this value).The keys are given by the strings after the value (key1, key2, ... in the example), i.e. there are multiple keys possible. If no key matches the input string, the cell content remains the same. Only exact matches are possible.

Note: The dictionary does not get saved to the archive when the flow is exported. The dictionary file needs to be saved/exported separately.

Dialog Options

Target Column
The column containing the to-be-replaced elements.
Dictionary Location
The plain text file containing the dictionary entries (see above).
Delimiter in Dictionary
The delimiter character used in the dictionary file. In the above example this is a single comma (',') but can be (almost) any character. Special characters available are '\t' for a tab and '\\' for a single backslash.
Append Column
If checked, the replaced values will be put into a separate new column, which is appended to the table (specify the name in the textfield). If unchecked, the target column is replaced.

Ports

Input Ports
0 Arbitrary input data.
Output Ports
0 Input data but with input target column replaced or with an additional column.
This node is contained in KNIME Base Nodes provided by KNIME GmbH, Konstanz, Germany.