Mask Entities

Protect sensitive information by replacing entities with a placeholder value. This helps to prevent disclosure of sensitive information while maintaining the overall context of the text.

Parameters

  • Source Column: The column name containing the text and entities you want to replace with a mask. Defaults to content.
  • Destination Column: The column name that holds the text with masked entities. Defaults to masked_entities.
  • Mask URLs: Define what to replace URLs with. Defaults to <URL>.
  • Mask Emails: Define what to replace emails with. Defaults to <EMAIL>.
  • Mask Phone Numbers: Define what to replace phone numbers with. Defaults to <PHONE>.
  • Mask Numbers: Define what to replace numbers with. Defaults to <NUMBER>.
  • Mask Digits: Define what to replace digits with. Defaults to 0.
  • Mask Currency Symbols: Define what to replace currency symbols with. Defaults to <CUR>.
  • Mask Punctuation: Define what to replace punctuation marks with. Defaults to empty string.

Usage

To use the Mask Entities transformation, you will need to follow these steps:

  1. Specify the Source Column parameter with the name of the column that contains the text with entities you want to mask.
  2. Specify the Destination Column parameter with the name of the column that will hold the text with masked entities.
  3. Define the mask values for specific entity types, such as URLs, emails, phone numbers, numbers, digits, and currency symbols. Note that you can provide any mask value that fits your use case.
  4. Run the transformation by clicking the Save and Run Transforms button. The resulting dataset will have a new column with the specified name containing the transformed text.

Example 1: Masking URLs, Emails, and Phone Numbers

Suppose you have a dataset of customer feedback and you want to mask URLs, emails, and phone numbers in the "feedback" column.

IDFeedback
1Great product! Check out my website: http://www.example.com/. Contact me at [email protected] or 555-1234.
2I love this! Email me at [email protected] for more info. My website is https://www.jane-shop.com/.

Parameters (YAML):

Note that, you use the Mask Phone Numbers transformation to mask entire phone numbers in the text. For example, "Contact me at 555-1234" becomes "Contact me at <PHONE>."

Use the parameters as the configuration in the Mantium app

transform:
  name: Mask Entities
  parameters:
    source_column: feedback
    destination_column: masked_entities
    mask_urls: <URL>
    mask_emails: <EMAIL>
    mask_phone_numbers: <PHONE>

The resulting dataset would look like this:

IDFeedbackMasked_Entities
1Great product! Check out my website: http://www.example.com/. Contact me at [email protected] or 555-1234.Great product! Check out my website: . Contact me at or .
2I love this! Email me at [email protected] for more info. My website is https://www.jane-shop.com/.I love this! Email me at for more info. My website is .

Example 2: Masking Numbers and Currency Symbols

Suppose you have a dataset of product descriptions and you want to mask numbers and currency symbols in the "description" column.

IDFeedback
1Buy 2 Get 1 Free! Men's Stylish Shoes - $99.99 only!
2Limited Time Offer: Women's Handbag for just $59.95! 50% off!

Parameters (YAML):

Note that you use;

  • The Mask Numbers transformation to mask any continuous sequence of digit characters (numbers) in the text. For example, "Contact me at 555-1234" becomes "Contact me at <NUMBER>-<NUMBER>."
  • The Mask Digits transformation to mask individual digit characters in the text. For example, "Contact me at 555-1234" becomes "Contact me at 000-0000."

Use the parameters as the configuration in the Mantium app

transform:
  name: Mask Entities
  parameters:
    source_column: description
    destination_column: masked_entities
    mask_numbers: <NUMBER>
    mask_currency_symbols: <CUR>

Expected Result Dataset:

IDDescriptionRemoved_Entities
1Buy 2 Get 1 Free! Men's Stylish Shoes - $99.99 only!Buy Get Free! Men's Stylish Shoes - only!
2Limited Time Offer: Women's Handbag for just $59.95! 50% off!Limited Time Offer: Women's Handbag for just ! % off!