Initialization of the line recognition class with language processing
Initialize an instance of the line recognition class with language processing to prepare for line recognition. The basic initialization procedure is the same as the line recognition class. Execute "msetlangdict" after the normal initialization. The language dictionary provided as standard in NGKOCR Ver 1.0 is "jcongram.ngm".
Setting of the language dictionary
void msetlangdict(char* ngramfilename);
If you specify NULL as ngramfilename, the language dictionary will be removed in subsequent recognition. Also, if you specify a different language dictionary as ngramfilename, the previous language dictionary will be removed and the new language dictionary will be referenced in subsequent recognition.
You can call this function multiple times.
Example
#include "ocrdef.h"
#include "ocrco.h"
#include "cjocrstock.h"
#include "cjocrdict98.h"
#include "cjocrpat98.h"
#include "cjocrrec98.h"
#include "cjocrline98.h"
#include "cjocrlang.h"
#include "errcode.h"
...
....
// Create the pattern class
CJocrPattern* pattern = new CJocrPattern;
int ret = pattern->mallocmemory();
if(ret < 0) {
printf("Pattern Class Memory Allocation Error");
delete pattern;
exit(1);
}
// Create the dictionary class
CJocrDict* pjocrdict = new CJocrDict;
pjocrdict->msetsystemdict("c:\\dic\\feature\\system");
pjocrdict->msetsystemdict("c:\\dic\\feature\\systemfat");
pjocrdict->msetuserdict("c:\\dic\\feature\\user");
ret = pjocrdict->mloaddict();
if(ret < 0) {
printf("Error");
delete pjocrdict;
delete pattern;
exit(1);
}
// Create the single character recognition class
CJocrRecognize* precognize = new CJocrRecognize;
precognize->msetpatter(pattern);
precognize->msetdict(pjocrdict);
// Initialize the single character recognition class
ret = precognize->mallocmemory();
if(ret < 0) {
printf("Error");
delete precognize;
delete pjocrdict;
delete pattern;
exit(1);
}
// Create the line recognition class with language processing
CJocrLang* pjocrlang = new CJocrLang;
pjocrlang->msetpatter(pattern);
pjocrlang->msetrecognize(precognize);
pjocrlang->msetlangdict("c:\\dic\\feature\\jcongram.ngm");
....
...
..
delete pjocrlang;
delete precognize;
delete pjocrdict;
delete pattern;