Syriac OCR in C# and .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English

126 種其他語言

IronOCR 是一款 C# 軟體元件,讓 .NET 程式設計師能夠從 126 種語言(包括西里亞語)的圖片和 PDF 文件中讀取文字。

這是 Tesseract 的進階分支版本,專為 .NET 開發人員打造,無論在速度或精準度方面,表現均定期優於其他 Tesseract 引擎。

IronOcr.Languages.Syriac 的內容

此套件包含 108 種適用於 .NET 的 OCR 語言:

  • 敘利亞語
  • 敘利亞語Best
  • 敘利亞語Fast
  • 敘利亞字母
  • 敘利亞字母Best
  • 敘利亞字母Fast

下載

西里亞語語言套件 [Syriac]

安裝

第一步是將 Syriac OCR 套件安裝至您的 .NET 專案中。

Install-Package IronOcr.Languages.Syriac

程式碼範例

此 C# 程式碼範例可從圖片或 PDF 文件中讀取西里亞文。

// Import the IronOcr library
using IronOcr;

class Program
{
    static void Main()
    {
        // Instantiate the IronTesseract object
        var Ocr = new IronTesseract();

        // Set the language to Syriac
        Ocr.Language = OcrLanguage.Syriac;

        // Create an OCR input from an image file
        using (var Input = new OcrInput(@"images\Syriac.png"))
        {
            // Read the image and extract the text
            var Result = Ocr.Read(Input);

            // Retrieve the full recognized text
            var AllText = Result.Text;

            // Output the text to the console
            Console.WriteLine(AllText);
        }
    }
}
// Import the IronOcr library
using IronOcr;

class Program
{
    static void Main()
    {
        // Instantiate the IronTesseract object
        var Ocr = new IronTesseract();

        // Set the language to Syriac
        Ocr.Language = OcrLanguage.Syriac;

        // Create an OCR input from an image file
        using (var Input = new OcrInput(@"images\Syriac.png"))
        {
            // Read the image and extract the text
            var Result = Ocr.Read(Input);

            // Retrieve the full recognized text
            var AllText = Result.Text;

            // Output the text to the console
            Console.WriteLine(AllText);
        }
    }
}
' Import the IronOcr library
Imports IronOcr

Friend Class Program
	Shared Sub Main()
		' Instantiate the IronTesseract object
		Dim Ocr = New IronTesseract()

		' Set the language to Syriac
		Ocr.Language = OcrLanguage.Syriac

		' Create an OCR input from an image file
		Using Input = New OcrInput("images\Syriac.png")
			' Read the image and extract the text
			Dim Result = Ocr.Read(Input)

			' Retrieve the full recognized text
			Dim AllText = Result.Text

			' Output the text to the console
			Console.WriteLine(AllText)
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

在此範例中:

  • 我們建立 IronTesseract 的實例來處理 OCR。
  • Ocr.Language 已設定為 Syriac,以確保此語言的文字辨識精準度。
  • 我們將一張包含西里亞文的圖片載入 OcrInput,並使用 Ocr.Read 進行處理。
  • 識別出的文字隨後會儲存於 Result.Text 中,您可在應用程式中進一步利用此資料。