Unify and manage your data

Example 2 - Using a Custom Comparator and Token Class

This example provides information about how to use a custom comparator.

Please review the example match rule configuration below. It has the following characteristics:

  • Uses a custom comparator class and custom match token class for the Organization Name.
  • Uses the DistinctWords comparator and DistinctWords match token class as the basis for the custom classes.
  • Notice the symmetry of how the comparator and match token classes are defined.
  • Uses the Stemmer and Soundex functions within the custom classes.
  • Uses a custom noise words dictionary.
  • Uses exact match on five attributes, and fuzzy on one attribute.
  • Only operates on profiles where the address type = Shipping
  • Only operates on profiles where the OrgJourneyStatus is not Generic Account or House Account.
  • Uses ignoreInToken to suppress tokenization on four attributes as they are deemed not helpful for identifying match candidates
  • Unnecessarily uses ExactOrNull and ExactOrAllNull together. Only one of them should have been used.
 {
          "uri": "configuration/entityTypes/Organization/matchGroups/FuzzyNameandExactAddressPhone",
          "label": "(Fuzzy) Name, (Exact) AddressLine1, City, State, Phone Number, (Equals) Shipping",
          "type": "suspect",
          "scope": "ALL",
          "useOvOnly": "true",
          "rule": {
            "matchTokenClasses": {
              "mapping": [
                {
                  "attribute": "configuration/entityTypes/Organization/attributes/Name",
                  "parameters": [
                    {
                      "parameter": "groups",
                      "values": [
                        {
                          "classParams": {
                            "threshold": "45%",
                            "useStemmer": "true",
                            "useSoundex": "true"
                          },
                          "className": "com.reltio.match.token.DistinctWordsMatchToken",
                          "noiseDictionary": "https://s3.amazonaws.com/reltio.match.test/Acme/AcmeNoiseDictionary.txt"
                        }
                      ]
                    }
                  ],
                  "class": "com.reltio.match.token.CustomMatchToken"
                }
              ]
            },
            "comparatorClasses": {
              "mapping": [
                {
                  "attribute": "configuration/entityTypes/Organization/attributes/Name",
                  "parameters": [
                    {
                      "parameter": "groups",
                      "values": [
                        {
                          "classParams": {
                            "threshold": "45%",
                            "useStemmer": "true",
                            "useSoundex": "true"
                          },
                          "className": "com.reltio.match.comparator.DistinctWordsComparator",
                          "noiseDictionary": "https://s3.amazonaws.com/reltio.match.test/Acme/AcmeNoiseDictionary.txt"
                        }
                      ]
                    }
                  ],
                  "class": "com.reltio.match.comparator.CustomComparator"
                }
              ]
            },
            "and": {
              "exact": [
                "configuration/entityTypes/Organization/attributes/Addresses/attributes/AddressLine1",
                "configuration/entityTypes/Organization/attributes/Addresses/attributes/City",
                "configuration/entityTypes/Organization/attributes/Addresses/attributes/StateProvince",
                "configuration/entityTypes/Organization/attributes/Phone/attributes/Number",
                "configuration/entityTypes/Organization/attributes/Addresses/attributes/AddressType"
              ],
              "equals": [
                {
                  "values": [
                    "Shipping"
                  ],
                  "uri": "configuration/entityTypes/Organization/attributes/Addresses/attributes/AddressType"
                }
              ],
              "fuzzy": [
                "configuration/entityTypes/Organization/attributes/Name"
              ],
              "ignoreInToken": [
                "configuration/entityTypes/Organization/attributes/Phone/attributes/Number",
                "configuration/entityTypes/Organization/attributes/Addresses/attributes/AddressType",
                "configuration/entityTypes/Organization/attributes/BuyerLifecycleStatus/attributes/OrgJourneyStatus",
                "configuration/entityTypes/Organization/attributes/Addresses/attributes/StateProvince"
              ],
              "notEquals": [
                {
                  "values": [
                    "Generic Account",
                    "House Account"
                  ],
                  "uri": "configuration/entityTypes/Organization/attributes/BuyerLifecycleStatus/attributes/OrgJourneyStatus"
                }
              ],
              "or": {
                "exactOrNull": [
                  "configuration/entityTypes/Organization/attributes/DUNSNumber"
                ],
                "exactOrAllNull": [
                  "configuration/entityTypes/Organization/attributes/DUNSNumber"
                ]
              }
            }
          },
          "scoreStandalone": 0,
          "scoreIncremental": 0
        }