/usr/include/tesseract/adaptive.h is in libtesseract-dev 3.02.01-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | /******************************************************************************
** Filename: adaptive.h
** Purpose: Interface to adaptive matcher.
** Author: Dan Johnson
** History: Fri Mar 8 10:00:49 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 ADAPTIVE_H
#define ADAPTIVE_H
/*----------------------------------------------------------------------------
Include Files and Type Defines
----------------------------------------------------------------------------*/
#include "oldlist.h"
#include "intproto.h"
#include <stdio.h>
typedef struct
{
uinT16 ProtoId;
uinT16 dummy;
PROTO_STRUCT Proto;
}
TEMP_PROTO_STRUCT;
typedef TEMP_PROTO_STRUCT *TEMP_PROTO;
typedef struct
{
uinT8 NumTimesSeen;
uinT8 ProtoVectorSize;
PROTO_ID MaxProtoId;
LIST ContextsSeen;
BIT_VECTOR Protos;
int FontinfoId; // font information inferred from pre-trained templates
} TEMP_CONFIG_STRUCT;
typedef TEMP_CONFIG_STRUCT *TEMP_CONFIG;
typedef struct
{
UNICHAR_ID *Ambigs;
int FontinfoId; // font information inferred from pre-trained templates
} PERM_CONFIG_STRUCT;
typedef PERM_CONFIG_STRUCT *PERM_CONFIG;
typedef union
{
TEMP_CONFIG Temp;
PERM_CONFIG Perm;
} ADAPTED_CONFIG;
typedef struct
{
uinT8 NumPermConfigs;
uinT8 MaxNumTimesSeen; // maximum number of times any TEMP_CONFIG was seen
uinT8 dummy[2]; // (cut at matcher_min_examples_for_prototyping)
BIT_VECTOR PermProtos;
BIT_VECTOR PermConfigs;
LIST TempProtos;
ADAPTED_CONFIG Config[MAX_NUM_CONFIGS];
} ADAPT_CLASS_STRUCT;
typedef ADAPT_CLASS_STRUCT *ADAPT_CLASS;
typedef struct
{
INT_TEMPLATES Templates;
int NumNonEmptyClasses;
uinT8 NumPermClasses;
uinT8 dummy[3];
ADAPT_CLASS Class[MAX_NUM_CLASSES];
} ADAPT_TEMPLATES_STRUCT;
typedef ADAPT_TEMPLATES_STRUCT *ADAPT_TEMPLATES;
/*----------------------------------------------------------------------------
Public Function Prototypes
----------------------------------------------------------------------------*/
#define NumNonEmptyClassesIn(Template) ((Template)->NumNonEmptyClasses)
#define IsEmptyAdaptedClass(Class) ((Class)->NumPermConfigs == 0 && \
(Class)->TempProtos == NIL_LIST)
#define ConfigIsPermanent(Class,ConfigId) \
(test_bit ((Class)->PermConfigs, ConfigId))
#define MakeConfigPermanent(Class,ConfigId) \
(SET_BIT ((Class)->PermConfigs, ConfigId))
#define MakeProtoPermanent(Class,ProtoId) \
(SET_BIT ((Class)->PermProtos, ProtoId))
#define TempConfigFor(Class,ConfigId) \
((Class)->Config[ConfigId].Temp)
#define PermConfigFor(Class,ConfigId) \
((Class)->Config[ConfigId].Perm)
#define IncreaseConfidence(TempConfig) \
((TempConfig)->NumTimesSeen++)
void AddAdaptedClass(ADAPT_TEMPLATES Templates,
ADAPT_CLASS Class,
CLASS_ID ClassId);
void FreeTempProto(void *arg);
void FreeTempConfig(TEMP_CONFIG Config);
ADAPT_CLASS NewAdaptedClass();
void free_adapted_class(ADAPT_CLASS adapt_class);
void free_adapted_templates(ADAPT_TEMPLATES templates);
TEMP_CONFIG NewTempConfig(int MaxProtoId, int FontinfoId);
TEMP_PROTO NewTempProto();
ADAPT_CLASS ReadAdaptedClass(FILE *File);
PERM_CONFIG ReadPermConfig(FILE *File);
TEMP_CONFIG ReadTempConfig(FILE *File);
void WriteAdaptedClass(FILE *File, ADAPT_CLASS Class, int NumConfigs);
void WritePermConfig(FILE *File, PERM_CONFIG Config);
void WriteTempConfig(FILE *File, TEMP_CONFIG Config);
#endif
|