OCR Checker: Excel Parses OCR Output Text File Words using Wiktionary Word Selection
In this article, we will discuss a simple OCR (Optical Character Recognition) checker that uses Excel to parse OCR output text files and check the selected words using Wiktionary's word selection feature. This checker is designed to help users evaluate the accuracy of their OCR software by comparing the recognized words against a reliable dictionary source.
How Does the OCR Checker Work?
The OCR checker consists of three main components:
- OCR Software: This software is responsible for recognizing text from images or documents.
- Text File Output: The OCR software generates a text file containing the recognized words.
- Excel Parsing and Wiktionary Word Selection: This process involves using Excel to parse the text file and check the selected words using Wiktionary's word selection feature.
Parsing the OCR Output Text File with Excel
To parse the OCR output text file with Excel, you can follow these steps:
- Open a new Excel workbook.
- Import the OCR output text file into Excel using the "Data" tab and selecting "From Text/CSV".
- Clean up the data by removing any unnecessary columns or rows.
- Save the Excel file as a Macro-Enabled Workbook (.xlsm) to enable the use of VBA macros.
Checking Selected Words using Wiktionary Word Selection
To check selected words using Wiktionary's word selection feature, you can use the following VBA code:
Sub WiktionaryWordSelection()
Dim word As Variant
Dim url As String
Dim response As String
Dim http As Object
Dim html As New HTMLDocument
Set http = CreateObject("MSXML2.XMLHTTP")
For Each word In Selection
url = "https://en.wiktionary.org/wiki/" & word
http.Open "GET", url, False
http.send
response = http.responseText
html.body.innerHTML = response
If html.querySelector("h1") Is Nothing Then
Debug.Print word & " - Not Found"
Else
Debug.Print word & " - Found"
End If
Next word
End Sub
This VBA code uses the XMLHTTP object to send a GET request to Wiktionary's API and retrieve the HTML content for each selected word. It then parses the HTML content using the HTMLDocument object and checks if the word exists in Wiktionary by looking for the presence of an
tag. If the
tag is found, the word is considered to be present in Wiktionary. Otherwise, it is considered to be absent.
Evaluating the OCR Accuracy
After checking the selected words using Wiktionary's word selection feature, you can evaluate the accuracy of the OCR software by comparing the number of recognized words that are present in Wiktionary against the total number of recognized words. This can help you identify any potential issues with the OCR software and take appropriate action to improve its accuracy.
In this article, we have discussed a simple OCR checker that uses Excel to parse OCR output text files and check selected words using Wiktionary's word selection feature. By following the steps outlined in this article, you can easily evaluate the accuracy of your OCR software and take appropriate action to improve its performance.