C# と .NET でのシンハラ語 OCR

This article was translated from English: Does it need improvement?
Translated
View the article in English
Other versions of this document:

IronOCR は、.NET コーダーがシンハラ語を含む 126 の言語で画像や PDF ドキュメントからテキストを読み取ることを可能にする C# ソフトウェア コンポーネントです。

これは、.NET 開発者専用に構築された Tesseract の高度なフォークであり、速度と精度の両方で他の Tesseract エンジンを常に上回っています。

IronOcr.Languages.Sinhala の内容

このパッケージには、.NET 用の 114 の OCR 言語が含まれています。

  • シンハラ語
  • シンハラ語ベスト
  • シンハラ断食
  • SinhalaAlphabet
  • シンハラ語アルファベットベスト
  • シンハラ語アルファベット高速

ダウンロード

シンハラ語言語パック[シンハラ語]

  • Zip形式でダウンロード
  • NuGetでインストール

インストール

最初に、シンハラ語OCR パッケージを .NET プロジェクトにインストールする必要があります。

Install-Package IronOCR.Languages.Sinhala

Code Example

この C# コード例は、画像または 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
$vbLabelText   $csharpLabel

説明:

  • IronTesseract : これはテキスト認識に使用されるメインの OCR エンジン クラスです。 -言語: 認識するテキストの言語を指定します。 この場合はシンハラ語です。
  • OcrInput : テキスト認識を実行する必要がある入力ファイル (画像または PDF) を表します。 -読み取り: 入力ファイルに対して OCR プロセスを実行し、認識されたテキストを返します。
  • Result.Text : 入力ファイルから OCR で認識されたテキストが含まれており、さらに処理したり表示したりするために使用できます。