Defining a Culture-Specific Parsing Grammar - spectrum_quality_1 - 23.1

Spectrum Data Quality Guide

Product type
Product family
Spectrum > Quality > Spectrum Quality
Product name
Spectrum Data Quality
Spectrum Data Quality Guide
Topic type
How Do I
First publish date

A culture-specific parsing grammar allows you to specify different parsing rules for different languages and cultures. This allows you to parse data from different countries in a single Open Parser stage, for example phone numbers from the United States and phone numbers from the United Kingdom. By default, each input record is parsed using each culture's parsing grammar, in the order specified in the Open Parser stage. You can also add a CultureCode field to the input records if you want a specific culture's parsing grammar to be used for that record. For more information, see Assigning a Parsing Culture to a Record.

Note: If you want to create a domain-independent parsing grammar, see Defining Domain-Independent Parsing Grammars in Dataflows.
  1. In Enterprise Designer, go to Tools > Open Parser Domain Editor.
  2. Click the Domains tab.
  3. Click Add.
  4. Type a domain name in the Name field.
  5. Type a description of the domain name in the Description field.
  6. If you want to create a new, empty domain, click OK. If you want to create a new domain based on another domain, do the following:
    1. Select Use another domain as a template if you want to create a new domain based on another domain.
    2. Select a domain from the list. When you click OK in the next step, the new domain will be created. The new domain will contain all of the culture-specific parsing grammars defined in the domain template that you selected.
    3. Click OK.
  7. Define the parsing grammar for the global culture. The global culture is the default culture and is used to parse records that have a culture for which no culture-specific parsing grammar has been defined.
    1. On the Grammars tab, select the new domain you created.
    2. If you created a domain from a template, there may be cultures already listed.
      • If there are cultures listed, select Global Culture then click Edit.
      • If there are no cultures listed, click Add, select Global Culture then click OK.
    3. On the Grammar tab, write the parsing grammar for the global culture. You can use the Commands, Grammar Rules, and RegEx Tags tabs to insert predefined parsing grammar elements. To enter a predefined element, place the cursor where you want to insert the element then double-click the element you want to add.

      The Commands tab displays parsing commands. For information about the commands available, see Grammars.

      The Grammar Rules tab displays grammar rules that you create in the Culture Properties dialog box. For more information about creating grammar rules, see Defining a Culture's Grammar Rules.

      The RegEx Tags tab displays RegEx tags that you create in the Culture Properties dialog box. For more information about creating RegEx tags, see Defining Culture RegEx Tags.

    4. To check the grammar syntax you have created, click Validate. The parsing grammar validation feature displays any errors in your grammar syntax and includes the error encountered, the line and column where the error occurs, and the command, grammar rule, or RegEx tag where the error occurs.
    5. To test the results of your grammar with sample data, click the Preview tab. Under Input Data, enter sample data you want to parse. Enter one record per row. Then, click the Preview button. The parsed output fields display in the Results grid. For information about the output fields, see Output. For information about trace, see Tracing Final Parsing Results. If your results are not what you expected, click the Grammars tab and continue editing the parsing grammar and testing representative input data until the parsing grammar produces the expected results.
    6. Click OK when you are done defining the parsing grammar for the global culture.
  8. Define a culture-specific grammar for each culture you want. To add culture-specific grammars, click Add and define the grammar using the same steps as for the global culture. Repeat as needed to add as many cultures as you need.
  9. When you are done adding culture-specific parsing grammars, click OK.

The domain and cultures you have created can now be used in the Open Parser stage to perform parsing.