Is it possible to check to see if something is a percentage match?

Certified Senior Developer

Hi there,

I have a desired requirement from a client about checking to see if two values are an 85% match. So for example, if a user entered ABC, Inc. for one value and ABC, Co. for another, it would be flagged. This is just one example, if the similarity of names was in the middle or end of the value, it would also be flagged. I just can't seem to wrap my head around any logic to make this possible. Any suggestions? Thanks!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Try your luck with soundex().

    a!localVariables(
      local!name1: "ABC, Inc.",
      local!name2: "ABC, Co.",
      {
        soundex(local!name1),
        soundex(local!name2)
      }
    )

    Returns: 

    {"A125", "A122"}

    Compare the first letter, and then the numbers and check whether they are within a certain range.

    But I am not sure whether that works for all the cases you have in mind.

  • I'd also toyed with soundex() although I think it's core purpose is to establish whether two words are homophones (i.e. they sound like each other e.g. "Smith" and "Smyth")

    I also considered splitting the names into their consistent parts using any spaces that might exist and then seeing if any of those constituents in the first appear in the second. But that would depend if your data reliably has convenient spaces in it - like your example does - and whether the components are indeed identical - again, as per your example: "ABC".

    This:

    a!localVariables(
      local!string1components: fn!split(ri!string1, " "),
      local!string2components: fn!split(ri!string2, " "),
      a!flatten(
        a!forEach(
          items: local!string1components,
          expression: a!localVariables(
            local!component: fv!item,
            a!forEach(
              items: local!string2components,
              expression: local!component = fv!item
            )
          )
        )
      )
    )

    ...for you example returns this:

    which indicates one out of the four constituents across your two names is the same value. Converting that into a % match is something different...

Reply
  • I'd also toyed with soundex() although I think it's core purpose is to establish whether two words are homophones (i.e. they sound like each other e.g. "Smith" and "Smyth")

    I also considered splitting the names into their consistent parts using any spaces that might exist and then seeing if any of those constituents in the first appear in the second. But that would depend if your data reliably has convenient spaces in it - like your example does - and whether the components are indeed identical - again, as per your example: "ABC".

    This:

    a!localVariables(
      local!string1components: fn!split(ri!string1, " "),
      local!string2components: fn!split(ri!string2, " "),
      a!flatten(
        a!forEach(
          items: local!string1components,
          expression: a!localVariables(
            local!component: fv!item,
            a!forEach(
              items: local!string2components,
              expression: local!component = fv!item
            )
          )
        )
      )
    )

    ...for you example returns this:

    which indicates one out of the four constituents across your two names is the same value. Converting that into a % match is something different...

Children
No Data