Sinhala OCR in C# and .NET
Outras versões deste documento:
O IronOCR é um componente de software C# que permite aos programadores .NET ler texto de imagens e documentos PDF em 126 idiomas, incluindo o cingalês.
Trata-se de uma versão avançada do Tesseract, criada exclusivamente para desenvolvedores .NET , e que supera regularmente outros mecanismos do Tesseract tanto em velocidade quanto em precisão.
Conteúdo de IronOcr.Idiomas.Sinhala
Este pacote contém 114 idiomas OCR for .NET:
- Sinhala
- SinhalaBest
- SinhalaFast
- Alfabeto Sinhala
- SinhalaAlphabetBest
- Alfabeto Sinhala Rápido
Baixar
Pacote de idioma cingalês [සංහල]
Instalação
A primeira coisa que precisamos fazer é instalar o pacote OCR de cingalês no seu projeto .NET.
Install-Package IronOcr.Languages.Sinhala
Exemplo de código
Este exemplo de código C# lê texto em cingalês de uma imagem ou documento PDF.
// Import the IronOcr namespace
using IronOcr;
class SinhalaOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Sinhala language
Ocr.Language = OcrLanguage.Sinhala;
// Define the input image or PDF file
using (var Input = new OcrInput(@"images\Sinhala.png"))
{
// Perform OCR on the input
var Result = Ocr.Read(Input);
// Retrieve the recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}
}
}
// Import the IronOcr namespace
using IronOcr;
class SinhalaOcrExample
{
static void Main()
{
// Initialize the IronTesseract OCR engine
var Ocr = new IronTesseract();
// Set the OCR engine to use the Sinhala language
Ocr.Language = OcrLanguage.Sinhala;
// Define the input image or PDF file
using (var Input = new OcrInput(@"images\Sinhala.png"))
{
// Perform OCR on the input
var Result = Ocr.Read(Input);
// Retrieve the recognized text
var AllText = Result.Text;
// Output the recognized text
Console.WriteLine(AllText);
}
}
}
' Import the IronOcr namespace
Imports IronOcr
Friend Class SinhalaOcrExample
Shared Sub Main()
' Initialize the IronTesseract OCR engine
Dim Ocr = New IronTesseract()
' Set the OCR engine to use the Sinhala language
Ocr.Language = OcrLanguage.Sinhala
' Define the input image or PDF file
Using Input = New OcrInput("images\Sinhala.png")
' Perform OCR on the input
Dim Result = Ocr.Read(Input)
' Retrieve the recognized text
Dim AllText = Result.Text
' Output the recognized text
Console.WriteLine(AllText)
End Using
End Sub
End Class
Explicação:
- IronTesseract : Esta é a principal classe de mecanismo OCR usada para reconhecimento de texto.
- Idioma : Especifica o idioma do texto a ser reconhecido; Neste caso, cingalês.
- OcrInput : Representa o arquivo de entrada (imagem ou PDF) onde o reconhecimento de texto precisa ser realizado.
- Ler : Executa o processo de OCR no arquivo de entrada e retorna o texto reconhecido.
- Result.Text : Contém o texto reconhecido pelo OCR a partir do arquivo de entrada, que pode ser usado para processamento ou exibição posterior.

