Defining a Culture's Grammar Rules - 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

You can use grammar rules for a culture to substitute a portion of a the global culture parsing grammar with strings, commands, or expressions specific to the culture or language. By defining a grammar rule, you can customize portions of the global culture parsing grammar based on the record's culture and/or language. This is useful if you do not want to create an entirely separate parsing grammar for each culture and instead use the global culture's grammar, customizing only specific portions of the global culture grammar for each culture.

This topic describes how to create a grammar rule for a culture.

  1. In Enterprise Designer, go to Tools > Open Parser Domain Editor.
  2. Click the Cultures tab.

    For a complete list of supported cultures, see Assigning a Parsing Culture to a Record.

  3. Select the culture to which you want to add a grammar rule then click Properties.
  4. Click the Grammar Rules tab. The information displayed includes the grammar rule names defined for the selected culture, the associated source culture, the defined value of the grammar rule, and the description.
  5. Click Add.
  6. Type a name for the grammar rule in the Name field.
  7. Type a description of the grammar rule in the Description field.
  8. Type the grammar rule in the Value field.

    The grammar rule can be any valid variable, string, command, or grouped expression. For more information, see Grammars.

  9. Select Enable word wrap to display the value in the text box without scrolling.
  10. Click OK.

    The grammar rule value that you typed is validated. If the value contains grammar syntax errors, a message displays a description of the errors encountered, the line and column where the error occurs, and the command, grammar rule, or RegEx tag where the error occurs.

Example Grammar Rule

You have a grammar that parses Western names. The structure of the pattern maybe the same for all cultures (<FirstName><MiddleName><LastName>) and many of the rules might match the same pattern or table. However, you also have culture-specific tables for last names, and you want to use the appropriate table based on the record's culture code.

To accomplish this, you could define a grammar rule for each culture that replaces the <LastName> element in the global culture with a reference to the culture-specific table. For example, if you have a table of Dutch last names, you would create a grammar rule for the Dutch (nl) culture as follows:

Name: LastName
Description: Dutch last names
Value: @Table("Dutch Last Names");