#include <stdio.h>
#include <locale.h>
#include "boxread.h"
#include "rect.h"
#include "strngs.h"
#include "tessopt.h"
#include "unichar.h"
#include "unicharset.h"
Go to the source code of this file.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
This program reads in a text file consisting of feature samples from a training page in the following format:
FontName UTF8-char-str xmin ymin xmax ymax page-number
NumberOfFeatureTypes(N)
FeatureTypeName1 NumberOfFeatures(M)
Feature1
...
FeatureM
FeatureTypeName2 NumberOfFeatures(M)
Feature1
...
FeatureM
...
FeatureTypeNameN NumberOfFeatures(M)
Feature1
...
FeatureM
FontName CharName ...
The result of this program is a binary inttemp file used by the OCR engine.
- Parameters
-
argc | number of command line arguments |
argv | array of command line arguments |
- Returns
- none
- Note
- Exceptions: none
-
History: Fri Aug 18 08:56:17 1989, DSJ, Created.
-
History: Mon May 18 1998, Christy Russson, Revistion started.
Definition at line 96 of file unicharset_extractor.cpp.
98 const char* output_directory =
".";
99 STRING unicharset_file_name;
103 setlocale(LC_ALL,
"");
107 printf(
"Usage: %s [-D DIRECTORY] FILE...\n", argv[0]);
113 while ((option =
tessopt(argc, argv,
"D" )) != EOF) {
123 unicharset_file_name = output_directory;
124 unicharset_file_name +=
"/";
125 unicharset_file_name += kUnicharsetFileName;
129 printf(
"Extracting unicharset from %s\n", argv[
tessoptind]);
131 FILE* box_file = fopen(argv[
tessoptind],
"rb");
132 if (box_file ==
NULL) {
133 printf(
"Cannot open box file %s\n", argv[
tessoptind]);
140 while (
ReadNextBox(&line_number, box_file, &unichar_string, &box)) {
148 printf(
"Wrote unicharset file %s.\n", unicharset_file_name.
string());
151 printf(
"Cannot save unicharset file %s.\n", unicharset_file_name.
string());
int tessopt(inT32 argc, char *argv[], const char *arglist)
bool save_to_file(const char *const filename) const
bool ReadNextBox(int *line_number, FILE *box_file, STRING *utf8_str, TBOX *bounding_box)
void unichar_insert(const char *const unichar_repr)
void set_properties(UNICHARSET *unicharset, const char *const c_string)
const char * string() const
void set_properties |
( |
UNICHARSET * |
unicharset, |
|
|
const char *const |
c_string |
|
) |
| |
Definition at line 55 of file unicharset_extractor.cpp.
void set_isupper(UNICHAR_ID unichar_id, bool value)
const UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
void set_islower(UNICHAR_ID unichar_id, bool value)
void set_ispunctuation(UNICHAR_ID unichar_id, bool value)
void set_isdigit(UNICHAR_ID unichar_id, bool value)
UNICHAR_ID wc_to_unichar_id(const UNICHARSET &unicharset, int wc)
static int utf8_step(const char *utf8_str)
void set_other_case(UNICHAR_ID unichar_id, UNICHAR_ID other_case)
void set_isalpha(UNICHAR_ID unichar_id, bool value)
Definition at line 43 of file unicharset_extractor.cpp.
45 char *unichar = uch.utf8_str();
const UNICHAR_ID unichar_to_id(const char *const unichar_repr) const