Tonga OCR in C# and .NET
IronOCR is a C# software component that allows .NET developers to read text from images and PDF documents in 126 languages, including Tonga. It is an advanced fork of Tesseract, tailored exclusively for .NET developers, and regularly outperforms other Tesseract engines for both speed and accuracy.
Contents of IronOcr.Languages.Tonga
This package contains three OCR language models specifically for Tonga:
- Tonga
- TongaBest
- TongaFast
Download
Tonga Language Pack [faka Tonga]
Installation
To start using the Tonga OCR capabilities, install the Tonga OCR package into your .NET project using the following NuGet command:
Install-Package IronOCR.Languages.Tonga
Code Example
The following C# code example demonstrates how to read Tonga text from an image or PDF document using IronOCR.
// Include the necessary IronOcr namespace
using IronOcr;
class TongaOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Tonga language pack
Ocr.Language = OcrLanguage.Tonga;
// Load the input image or PDF into OcrInput
using (var Input = new OcrInput(@"images\Tonga.png"))
{
// Perform OCR to read the text from the image
var Result = Ocr.Read(Input);
// Retrieve the full text recognition result
var AllText = Result.Text;
// Output the result or process further as needed
System.Console.WriteLine(AllText);
}
}
}
// Include the necessary IronOcr namespace
using IronOcr;
class TongaOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Tonga language pack
Ocr.Language = OcrLanguage.Tonga;
// Load the input image or PDF into OcrInput
using (var Input = new OcrInput(@"images\Tonga.png"))
{
// Perform OCR to read the text from the image
var Result = Ocr.Read(Input);
// Retrieve the full text recognition result
var AllText = Result.Text;
// Output the result or process further as needed
System.Console.WriteLine(AllText);
}
}
}
' Include the necessary IronOcr namespace
Imports IronOcr
Friend Class TongaOcrExample
Shared Sub Main()
' Initialize the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Set the OCR engine to use the Tonga language pack
Ocr.Language = OcrLanguage.Tonga
' Load the input image or PDF into OcrInput
Using Input = New OcrInput("images\Tonga.png")
' Perform OCR to read the text from the image
Dim Result = Ocr.Read(Input)
' Retrieve the full text recognition result
Dim AllText = Result.Text
' Output the result or process further as needed
System.Console.WriteLine(AllText)
End Using
End Sub
End Class
- This code example demonstrates initializing the IronTesseract OCR engine and setting it to use the Tonga language.
- We load an image from the specified path into an
OcrInput
object. - The
Ocr.Read()
method processes the input to extract text, and then we retrieve the recognized text via theResult.Text
property. - Finally, the extracted text can be output or processed as needed in the application.