使用 C# 和 .NET 進行敘利亞語 OCR 識別

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

還有126種語言

IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言(包括敘利亞)的文字。

它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。

IronOcr.Languages.Syriac 的內容

此軟體包包含 108 種適用於 .NET 的 OCR 語言:

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

  • 敘利亞字母表最佳
  • 敘利亞字母表快速

下載

敘利亞語語言包 [敘利亞語]

下載為Zip 檔案

安裝

第一步是在您的 .NET 專案中安裝敘利亞語OCR 套件。

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中,以便在您的應用程式中進一步使用。