Match Just exact words

Hi All,

I just need to match words of two paragraphs irrespective of any dots or spaces. Just match word by word and check if its match and if possible get the difference values.

First Text:

“If the initial invoice date stated above does not align to the execution date then the initial invoice date will be the execution date. Databricks reserves the right to accelerate scheduled billing of fees for the Specified Commitments and associated Support Services if any if Customers usage exceeds the related amount for which it has been billed. Additionally if Customers usage exceeds the applicable Specified Commitment or Universal Usage Commitment e.g. Burst Usage fees for such Burst Usage and for associated Support Services if any shall be billed monthly in arrears. Fees above do not include Trueup Payments if any which would be invoiced by Databricks after the End Date under the terms of this Order.”

Second Text

If the initial invoice date stated above does not align to the execution date then the initial invoice date will be the execution date. Databricks reserves the right to accelerate scheduled billing of fees for the Specified Commitments and associated Support Services if any if Customer’s usage exceeds the related amount for which it has been billed. Additionally if Customer’s usage exceeds the applicable Specified Commitment or Universal Usage Commitment e.g. Burst Usage fees for such Burst Usage and for associated Support Services if any shall be billed monthly in arrears. Fees above do not include True-up Payments if any which would be invoiced by Databricks after the End Date under the terms of this Order

Hi @dutta.marina

Assign activity -> firstText = "If the initial invoice date stated above does not align to the execution date then the initial invoice date will be the execution date. Databricks reserves the right to accelerate scheduled billing of fees for the Specified Commitments and associated Support Services if any if Customers usage exceeds the related amount for which it has been billed. Additionally if Customers usage exceeds the applicable Specified Commitment or Universal Usage Commitment e.g. Burst Usage fees for such Burst Usage and for associated Support Services if any shall be billed monthly in arrears. Fees above do not include Trueup Payments if any which would be invoiced by Databricks after the End Date under the terms of this Order."

Assign activity -> secondText = "If the initial invoice date stated above does not align to the execution date then the initial invoice date will be the execution date. Databricks reserves the right to accelerate scheduled billing of fees for the Specified Commitments and associated Support Services if any if Customer’s usage exceeds the related amount for which it has been billed. Additionally if Customer’s usage exceeds the applicable Specified Commitment or Universal Usage Commitment e.g. Burst Usage fees for such Burst Usage and for associated Support Services if any shall be billed monthly in arrears. Fees above do not include True-up Payments if any which would be invoiced by Databricks after the End Date under the terms of this Order"

Assign activity -> firstWords = firstText.Replace(".", "").Split(" "c)

Assign activity -> secondWords = secondText.Replace(".", "").Split(" "c)

Assign activity -> differences = firstWords.Zip(secondWords, Function(f, s) If(f <> s, 1, 0)).Sum()

Variable DataTypes

Regards

@vrdabberu

Can you please explain this line below

differences = firstWords.Zip(secondWords, Function(f, s) If(f <> s, 1, 0)).Sum()

@dutta.marina

firstWords.Zip(secondWords, Function(f, s) If(f <> s, 1, 0)): This part uses the Zip function to combine elements from two arrays (firstWords and secondWords) into pairs. For each pair of elements (f, s) where f is from firstWords and s is from secondWords, it applies the specified function: If(f <> s, 1, 0). If the elements f and s are different, it returns 1, indicating a difference; otherwise, it returns 0, indicating no difference.

.Sum(): This part calculates the sum of all the values returned by the function applied in the Zip function. Since the function returns 1 for differences and 0 for no differences, summing them up gives us the total number of differences between the two arrays.

Regards

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.