AddCustomDictionary Method (GdPictureOCR)
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.
'Declaration
Public Function AddCustomDictionary( _
ByVal As String _
) As GdPictureStatus
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.
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);
}
}