2007-03-08 04:03:40 +08:00
|
|
|
/******************************************************************************
|
|
|
|
** Filename: adaptmatch.h
|
|
|
|
** Purpose: Interface to high-level adaptive matcher
|
|
|
|
** Author: Dan Johnson
|
|
|
|
** History: Mon Mar 11 11:48:48 1991, DSJ, Created.
|
|
|
|
**
|
|
|
|
** (c) Copyright Hewlett-Packard Company, 1988.
|
|
|
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
** you may not use this file except in compliance with the License.
|
|
|
|
** You may obtain a copy of the License at
|
|
|
|
** http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
** Unless required by applicable law or agreed to in writing, software
|
|
|
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
** See the License for the specific language governing permissions and
|
|
|
|
** limitations under the License.
|
|
|
|
******************************************************************************/
|
|
|
|
#ifndef ADAPTMATCH_H
|
|
|
|
#define ADAPTMATCH_H
|
|
|
|
|
|
|
|
/**----------------------------------------------------------------------------
|
|
|
|
Include Files and Type Defines
|
|
|
|
----------------------------------------------------------------------------**/
|
|
|
|
#include "oldlist.h"
|
|
|
|
#include "tessclas.h"
|
|
|
|
#include "fxdefs.h"
|
|
|
|
#include "matchdefs.h"
|
|
|
|
#include "adaptive.h"
|
|
|
|
#include "ocrfeatures.h"
|
2007-07-18 09:15:07 +08:00
|
|
|
#include "ratngs.h"
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
|
|
Variables
|
|
|
|
----------------------------------------------------------------------------*/
|
|
|
|
extern float GoodAdaptiveMatch;
|
|
|
|
extern float GreatAdaptiveMatch;
|
|
|
|
extern int ReliableConfigThreshold;
|
|
|
|
extern int tess_cn_matching;
|
|
|
|
extern int tess_bn_matching;
|
|
|
|
extern int LearningDebugLevel;
|
|
|
|
|
|
|
|
/**----------------------------------------------------------------------------
|
|
|
|
Public Function Prototypes
|
|
|
|
----------------------------------------------------------------------------**/
|
2007-07-18 09:15:07 +08:00
|
|
|
LIST AdaptiveClassifier(TBLOB *Blob, TBLOB *DotBlob, TEXTROW *Row);
|
2007-03-08 04:03:40 +08:00
|
|
|
/**/
|
|
|
|
void AdaptToWord(TWERD *Word,
|
|
|
|
TEXTROW *Row,
|
2007-07-18 09:15:07 +08:00
|
|
|
const WERD_CHOICE& BestChoice,
|
|
|
|
const WERD_CHOICE& BestRawChoice,
|
2007-03-08 04:03:40 +08:00
|
|
|
const char *rejmap);
|
|
|
|
|
2007-07-18 09:15:07 +08:00
|
|
|
void EndAdaptiveClassifier();
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2007-07-18 09:15:07 +08:00
|
|
|
void InitAdaptiveClassifier();
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
void ResetAdaptiveClassifier();
|
|
|
|
|
2007-07-18 09:15:07 +08:00
|
|
|
void InitAdaptiveClassifierVars();
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2007-07-18 09:15:07 +08:00
|
|
|
void PrintAdaptiveStatistics(FILE *File);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2007-07-18 09:15:07 +08:00
|
|
|
void SettupPass1();
|
2007-03-08 04:03:40 +08:00
|
|
|
|
2007-07-18 09:15:07 +08:00
|
|
|
void SettupPass2();
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
void MakeNewAdaptedClass(TBLOB *Blob,
|
|
|
|
LINE_STATS *LineStats,
|
|
|
|
CLASS_ID ClassId,
|
|
|
|
ADAPT_TEMPLATES Templates);
|
|
|
|
|
|
|
|
int GetAdaptiveFeatures(TBLOB *Blob,
|
|
|
|
LINE_STATS *LineStats,
|
|
|
|
INT_FEATURE_ARRAY IntFeatures,
|
|
|
|
FEATURE_SET *FloatFeatures);
|
|
|
|
|
|
|
|
int AdaptableWord(TWERD *Word,
|
|
|
|
const char *BestChoice,
|
2007-07-18 09:15:07 +08:00
|
|
|
const char *BestChoice_lengths,
|
|
|
|
const char *BestRawChoice,
|
|
|
|
const char *BestRawChoice_lengths);
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
/**----------------------------------------------------------------------------
|
|
|
|
Global Data Definitions and Declarations
|
|
|
|
----------------------------------------------------------------------------**/
|
|
|
|
#endif
|