Hi All,
- I have a set of array stored keyword - {“space”,“versal”,“electronic”,“Regex”)
-
I have extracted text from OCR - Which looks like below
-
My bot should look my array keyword in OCR extracted text, if matches found with any one of the array keywords it should get the line number. ex
“versal” - keyword matched with line of “open universal search sentence”
The result should be 
The matching word found and the line number is - 3
Could anyone help me, please.
Thanks
Hi there @SrenivasanKanna
You can run LINQ or loop in a loop over the two arrays that you have (for linq convert it to List(of string))
- Run loop for your keyword array
- Inside the previous loop run your second array (in a loop) while the array has line elements split using \r and find a match (can use contains or something similar {Regex etc})
- Break loop once match found
Yeah , I have done this , now i want to get the line number of founded text.
Well,
You can convert your array to list and run this
int indexOfYourLine = yourList.FindIndex(a => a.YourLineString == ThematchedListElement);
the above is in C#.
1 Like
Thanks for your response.
I am not clear what u suggested, I need to get the line number of sentence ocr extracted text, not keywords.
arr keyword = {“space”,“versal”,“electronic”,“Regex”)
arr listkey = keyword.tolist()
ocr extracted text
ocr_text = en command palette\r\ngo to file\r\Open universal search\r\add an activity\r\Go to documentation"
now I need to get the word position of “Open universal search”
Ex : I hope line # start with 0
Answer should be 3
Okay I get it.
So you have two collections now.
- Keyword collection
- OCR text that is split using the \r char and convert it to list (collection of string)
Run a loop - For each Keyword in your Keyword collection
{
Run another loop - for each line in your OCR text split collection
{
if(your keyword is contained in the OCR item string)
{
then → assign it to result and BREAK
else → continue
}
}
}
Hope this helps 
PS : If you want the index you can either keep a recurring count or run the query I suggested in the previous answer.
1 Like
i will try thanks for your replay