GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureOCR Class / AddCustomDictionary Method
The name of the custom language dictionary file located in the defined resource folder. For example, you can use "eng2" for the dictionary file named eng2.traineddata.

This language dictionary is then added in the current GdPictureOCR object for subsequent use together with the previously added languages.

Example





In This Topic
AddCustomDictionary Method (GdPictureOCR)
In This Topic
Adds a custom language dictionary from the defined resource folder to be used during subsequent OCR processes. You are able to add multiple custom languages by calling this method for each custom language file according to your preference. The specified language is then added internally in the current GdPictureOCR object.
Syntax
'Declaration
 
Public Function AddCustomDictionary( _
   ByVal CustomDictionary As String _
) As GdPictureStatus
public GdPictureStatus AddCustomDictionary( 
   string CustomDictionary
)
public function AddCustomDictionary( 
    CustomDictionary: String
): GdPictureStatus; 
public function AddCustomDictionary( 
   CustomDictionary : String
) : GdPictureStatus;
public: GdPictureStatus AddCustomDictionary( 
   string* CustomDictionary
) 
public:
GdPictureStatus AddCustomDictionary( 
   String^ CustomDictionary
) 

Parameters

CustomDictionary
The name of the custom language dictionary file located in the defined resource folder. For example, you can use "eng2" for the dictionary file named eng2.traineddata.

This language dictionary is then added in the current GdPictureOCR object for subsequent use together with the previously added languages.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
Please ensure that the specified custom language dictionary file is located in the currently defined resource folder. You can download additional language dictionary files here.
Example
How to add multiple custom languages to be used by OCR.
Dim caption As String = "Example: AddCustomDictionary"
Using gdpictureOCR As GdPictureOCR = New GdPictureOCR()
    'Specify your resource folder for OCR dictionaries.
    gdpictureOCR.ResourcesFolder = "\GdPicture.Net 14\redist\OCR"
    'To add your custom english, german and french language, do the following:
    If (gdpictureOCR.AddCustomDictionary("eng2") = GdPictureStatus.OK) AndAlso
       (gdpictureOCR.AddCustomDictionary("deu2") = GdPictureStatus.OK) AndAlso
       (gdpictureOCR.AddCustomDictionary("fra2") = GdPictureStatus.OK) Then
        'You can do your another stuff with gdpictureOCR here.
    Else
        MessageBox.Show("The AddCustomDictionary() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption)
    End If
End Using
string caption = "Example: AddCustomDictionary";
using (GdPictureOCR gdpictureOCR = new GdPictureOCR())
{
    //Specify your resource folder for OCR dictionaries.
    gdpictureOCR.ResourcesFolder = "\\GdPicture.Net 14\\redist\\OCR";
 
    //To add your custom english, german and french language, do the following:
    if ((gdpictureOCR.AddCustomDictionary("eng2") == GdPictureStatus.OK) &&
        (gdpictureOCR.AddCustomDictionary("fra2") == GdPictureStatus.OK) &&
        (gdpictureOCR.AddCustomDictionary("deu") == GdPictureStatus.OK))
    {
        //You can do your another stuff with gdpictureOCR here.
    }
    else
    {
        MessageBox.Show("The AddCustomDictionary() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption);
    }
}
See Also