I did a test, which could be improved.
Updated end of code (from Dim ocrResult =...), by extracting words (I rounded Bottom for letters which are not aligned, but not perfect...),
then by sorting them by Bottom, then Left :
Dim ocrResult = Await ocrEng.RecognizeAsync(softwareBmp)
RichTextBox1.Clear()
Dim wordList As List(Of cText) = New List(Of cText)()
Dim lines As IReadOnlyList(Of OcrLine) = ocrResult.Lines
For Each line In lines
For Each word In line.Words
Dim nY As Double = CLng(word.BoundingRect.Bottom / 10) * 10
wordList.Add(New cText() With {.Text = word.Text, .LocY = nY, .LocX = word.BoundingRect.Left})
Next
Next
wordList.Sort(New WordComparer())
Dim oldLocY As Double = 0
For Each item As cText In wordList
'Console.WriteLine(item.Text)
If (item.LocY > oldLocY And oldLocY <> 0) Then
RichTextBox1.Text += Environment.NewLine
End If
RichTextBox1.Text += item.Text + " "
oldLocY = item.LocY
Next
with :
Public Class cText
Public Property Text As String
Public Property LocY As Double
Public Property LocX As Double
End Class
Class WordComparer
Implements IComparer(Of cText)
Public Function Compare(p1 As cText, p2 As cText) As Integer Implements System.Collections.Generic.IComparer(Of cText).Compare
Dim result = p1.LocY.CompareTo(p2.LocY)
If result = 0 Then
result = p1.LocX.CompareTo(p2.LocX)
End If
Return result
End Function
End Class