When to Use a Parser Transformation
Use the Parser transformation when the data fields in a column contain more than one type of information and you want to move the field values to new columns. The Parser transformation lets you create new column for each type of information in a data set.
The following examples describe some types of structural change you can perform with a Parser transformation.
- Create new columns for contact data
- You can create a data structure that parses name data from a single column into multiple columns. For example, you can create columns for salutations, first names, middle names, and surnames.
You configure the transformation with a probabilistic model that represents the structures of the person names on the input port. You use a sample of the input port data to define the model.
You create a token parsing strategy that applies the probabilistic model to the input port and writes the name values to new columns. The transformation writes the name values to the new columns based on the position of each value in the input string and the type of name that the value represents.
Note: You can also use a pattern-based parsing strategy to parse contact data. When you configure a pattern-based parsing strategy, you define the patterns that represents the structures of the names on the input port.
- Create address columns
- You can create a data structure that parses a single column of address data into multiple columns that describe a deliverable address.
- Configure the transformation with reference tables that contain recognizable address elements, such as ZIP Codes, state names, and city names. Create a token parsing strategy that writes each address element to a new port.
- You cannot use a reference table to parse street address data from an input string, because street name and number data is too general to be captured in a reference table. However, you can use the Overflow port to capture this data. When you have parsed all city, state, and ZIP data from an address, the remaining data contains street information.
- For example, use a token parsing strategy to split the following address into address elements:
123 MAIN ST NW STE 12 ANYTOWN NY 12345
- The parsing strategy can write the address elements to the following columns:
Column Name | Data |
---|
Overflow | 123 MAIN ST NW STE 12 |
City | ANYTOWN |
State | NY |
ZIP | 12345 |
- Create product data columns
- You can create a data structure that parses a single column of product data into multiple columns that describe the product inventory details.
- Configure the transformation with token sets that contain inventory elements, such as dimension, color, and weight. Create a token parsing strategy that writes each inventory element to a new port
- For example, use a token parsing strategy to split the following paint description into separate inventory elements:
500ML Red Matt Exterior
- The parsing strategy can write the address elements to the following columns:
Column Name | Data |
---|
Size | 500ML |
Color | Red |
Style | Matt |
Exterior | Y |