Speech redaction syntax and default rules

Use regular expressions in JSON objects to control text and audio redaction

For security purposes, Speech automatically redacts credit card numbers, social security numbers, and street addresses from the transcription and playback audio. Your company can choose to disable redaction if they wish to keep that information visible in Experience Cloud. To do so, as part of the transcription API request set apply_redaction to No.

Redaction rules can be applied to the connector used for Speech processing or they can be submitted with the API call. For more information, see:

Syntax

Redaction rules use a series of regular expression (regex) matches, specified in a JSON object. The regex field provides a regular expression to match against, while the repl field is the string to replace it with. The text and audio fields are boolean fields that control whether the text transcript and audio file are redacted.

ParameterTypeRequiredDefaultDescription
regexstringYesN/AA regular expression to match against.
replstringYesN/AThe string to replace the matched expression with.
textbooleanNotrueA boolean field that controls whether the text transcript is redacted. If true, the transcript is redacted according to the configured rules, and redacted text is replaced with the strings specified for each rule's repl field. If false, the transcript is not redacted for the specified rule.
reportbooleanNotrueWhen the rule triggers a transcript redaction, causes the transcription result to include a scrubbed field in JSON output with a value of true to indicate redaction was performed.
audiobooleanNotrueA boolean field that controls whether the audio file is redacted. If true, the audio file is redacted according to the configured rules, and redacted audio is replaced with silence. If false, audio is not redacted for the specified rule.

The following sample shows the syntax of a redaction rule:

{
  "regex": "string_to_be_redacted",
  "repl": "string_to_replace",
  "text" : true/false, [if false, override to not have text redacted]
  "audio" : true/false, [if false, override to not have audio redacted]
}

Rule and exclusion examples

The following rule redacts all numbers:

{
  "description": "replace all digits with #",
  "regex": "\\d",
  "repl": "#"
}

Because this rule redacts all numbers, most redaction rules are intended to exclude numbers from redaction. These exclusion rules are designed to allow numerals to pass through without being redacted.

Redaction rules are applied top-down, so the main redaction rule is typically placed at the end of the rules list. As a result, any numerals that don't match the preceding exclusion rules are redacted by this rule.

Customize the information you don't want to be redacted with rules that exclude characters from redaction. Exclusions are useful for avoiding unnecessary redaction such as product names that contain numbers.

Important: When specifying multiple redaction rules, order matters. If the regex strings in redaction rules overlap or conflict, the last one entered takes precedence.

The following example rules exclude certain characters from redaction.

Match 2 digit number and return 2 digit number:

{
  "description": "exclude 2 digit numbers from scrubbing (redaction)",
  "regex": "(^\\d{2}[.,]?$)",
  "repl": "\\1"
  "text": false,
  "report": false,
  "audio": false
}

Exclude alpha numeric:

{
  "description": "exclude alpha numeric - anything with both letters and numbers from scrubbing (redaction)",
  "regex": "^([A-Za-z]+\\d+\\w*|\\d+[A-Za-z]+\\w*)([.,?]?)$",
  "repl": "\\1",
  "text": false,
  "report": false,
  "audio": false
}

Default redaction rules

These rules are applied when redaction is turned on and no custom rules are included with the connector configuration or API call. When custom rules are included, these rules are still applied unless explicitly overridden. If default and custom rules overlap, custom rules take precedence.

{
  "description": "Exclude words that include non-digits other than punctuation from scrubbing (redaction)",
  "regex": "[^-+$%:0-9.,?]",
  "repl": "",
  "text": false,
  "report": false,
  "audio": false
},
{
  "description": "exclude ordinal numbers from scrubbing (redaction)",
  "regex": "^(¿)?(\\d+/)?\\d+(st|nd|rd|th|ᵒ|ᵃ|e|er|re)[.,?]?$",
  "repl": "",
  "text": false,
  "report": false,
  "audio": false
},
{
  "description": "exclude percentages from scrubbing (redaction)",
  "regex": "^(¿)?(\\d+[.,])?\\d+%[.,?]?$",
  "repl": "",
  "text": false,
  "report": false,
  "audio": false
},
{
  "description": "exclude clock times from scrubbing (redaction)",
  "regex": "^(¿)?([1-9]|10|11|12):[0-5][0-9]( [AP]M)?[.,?]?$",
  "repl": "",
  "text": false,
  "report": false,
  "audio": false
},
{
  "description": "exclude prices from scrubbing (redaction)",
  "regex": "^(¿)?([\\d,. ]+(R?\\$|€)|(R?\\$|€)[\\d,. ]+)[.,?]?$",
  "repl": "",
  "text": false,
  "report": false,
  "audio": false
},
{
  "description": "exclude short floating point numbers (w/decimal point) from scrubbing (redaction)",
  "regex": "^(¿)?\\d{1,4}[.,]\\d{1,4}[.,?]?$",
  "repl": "",
  "text": false,
  "report": false,
  "audio": false
},
{
  "description": "replace all other digits with #",
  "regex": "\\d",
  "repl": "#"
}