I have a question regarding partial match of two strings.
I have a string and I need to check it. To be more specific, I have output from OCR and it contains some mistakes. I need to check if the string is really there but as it can be written incorrectly I need only 70% match.
I don’t know if this is a really good answer, but if the wrong characters are consistently in a few places, you might be able to do a Regex pattern with an OR to have multiple patterns.
Hi , can you please paste the code invoked in the workflow? I am unable to see it as I have lower version of UiPath.
Thanks!
Could not find type ‘InvokeCode’ in namespace ‘http://schemas.uipath.com/workflow/activities’. Row: 95, Column: 8
s= original string argument
t = compare string argument
r= result int argument
Dim n As Integer = s.Length
Dim m As Integer = t.Length
Dim d(n + 1, m + 1) As Integer
If n = 0 Then
r= m
End If
If m = 0 Then
r= n
End If
Dim i As Integer
Dim j As Integer
For i = 0 To n
d(i, 0) = i
Next
For j = 0 To m
d(0, j) = j
Next
For i = 1 To n
For j = 1 To m
Dim cost As Integer
If t(j - 1) = s(i - 1) Then
cost = 0
Else
cost = 1
End If
d(i, j) = Math.Min(Math.Min(d(i - 1, j) + 1, d(i, j - 1) + 1),
d(i - 1, j - 1) + cost)
Next
Next
r= d(n, m)
Its working and I am just looking at the algorithm. So it will show how many words are different somehow.
Is it possible to adjust the code in order to have the percentage of mistakes on the whole string???
Imagine a situation that I have only 4 words and all of them contain one mistake. But it can be still 90% match.
Since the word count is being calculated for both string, i think you can calculate the percentage once the result is generated (outside code activity). I did not understand the 90% match part.
I was talking about characters, not the whole words.
For example in your algorithm if I have one word: “Word” and the second one would be “Wor” then it will show that I have 100% per cent mistakes. But from my point of view I have 75% match.
Wau…looks great!!
one more question. If I have an invoice and I need to check that it contains one number. But this number can be anywhere and there can be of course other numbers…How would you check it?
Imagine an invoice with text:
bla blabla blabla blabla 23.11.2017blabla blabla blabla blabla blabla blabla blabla blabla blabla bla bla blabla bla 123406 bla blabla blabla blabla bla
And I need to check if it contains 123456, or if it contains at least a match of 70%. Is it doable?