String Replacement Cleanser

Information about the string replacement cleanser. application.

This cleanser enables you to declare a set of source words or phrases and their replacements, to be applied to an attribute used in your match rules. You simply create a text file with any name you choose, e.g. myStringMods. In it, each line represents a source string and the replacement string, using the “=>” syntax between them. See example below.

  • avenue=>av
  • ave=>av
  • boulevard=>blvd
  • boul=>blvd
  • st=>str
  • Toll Bridge=>toll bridge
  • highway=>hwy
  • autoroute=>hwy
  • Autoroute=>hwy
  • Auto Route=>hwy
  • l'=>
  • d'=>
  • '=>
  • \=>
  • /=>
  • .=>
  • ~=>

Notice you can even have a null value on the right side to effectively eliminate the string but this is only recommended for a small number of replacements. If you need to support a large number of word removals, you should create a custom comparator and specify a text file that contains the words you wish ignored from the attribute during the match process.

If you want you can even use regex on the left side of the => to do more advanced matching of content. The following example uses \b to clearly delineate the whole phrase.

  • \b1\b=>
  • \b2\b=>
  • \b123\b=>
  • \b1234\b=>
  • \bADDRESS\b=>
  • \b860 RIDGELAKE BLVD\b=>
  • \bWILL PROVIDE\b=>
  • \bBSONNULL\b=>
  • \bNULL\b=>
  • \bSTREET ADDRESS\b=>
  • \b123 MAIN ST\b=>
  • \b123 Main St\b=>
  • \b123 MAIN\b=>

Your resulting text file must be instantiated into Reltio’s AWS account, associated with your tenant. This is achieved by filing a support ticket at support@reltio.com, with your text file attached and requesting the task Add file for String Replacement. You will receive a reply with the full path name of your text file which you will specify in the dictionary parameter of the cleanse element as shown in the example below.

"cleanse": [
    {
      "cleanseAdapter": "com.reltio.cleanse.impl.RegexpReplaceCleanser",
      "cleanseAdapterParams": {
        "dictionary": "https://s3.amazonaws.com/test.api.tmp.data/myStringMods.txt",
        "keepOriginalValue": "false"
      },
      "mappings": [
        {
          "attribute": "configuration/entityTypes/HCO/attributes/Name",
          "cleanseAttribute": "configuration/entityTypes/HCO/attributes/Name"
        }
      ]
    }
  ]

Always specify com.reltio.cleanse.impl.RegexpReplaceCleanser as the cleanseAdapter when leveraging a custom string replacement file.