Tonga OCR in C# and .NET
O IronOCR é um componente de software C# que permite aos desenvolvedores .NET ler texto de imagens e documentos PDF em 126 idiomas, incluindo o tonganês. Trata-se de uma versão avançada do Tesseract, desenvolvida exclusivamente para desenvolvedores .NET, e que supera regularmente outros mecanismos do Tesseract tanto em velocidade quanto em precisão.
Conteúdo de IronOcr.Languages.Tonga
Este pacote contém três modelos de linguagem OCR específicos para Tonga:
- Tonga
- TongaMelhor
- TongaFast
Baixar
Pacote de Idiomas Tonga [faka Tonga]
Instalação
Para começar a usar os recursos de OCR de Tonga , instale o pacote Tonga OCR em seu projeto .NET usando o seguinte comando NuGet:
Install-Package IronOcr.Languages.Tonga
Exemplo de código
O exemplo de código C# a seguir demonstra como ler texto em tonganês a partir de uma imagem ou documento PDF usando o 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
Este exemplo de código demonstra a inicialização do mecanismo OCR IronTesseract e sua configuração para usar o idioma Tonga.
- Carregamos uma imagem do caminho especificado em um objeto
OcrInput. - O método
Ocr.Read()processa a entrada para extrair o texto e então recuperamos o texto reconhecido através da propriedadeResult.Text. Por fim, o texto extraído pode ser exibido ou processado conforme necessário no aplicativo.

