#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 |
|
) |
| |
Public Function Prototypes
Definition at line 102 of file unicharset_extractor.cpp.
104 const char* output_directory =
".";
105 STRING unicharset_file_name;
108 setlocale(LC_ALL,
"");
114 printf(
"Usage: %s [-D DIRECTORY] FILE...\n", argv[0]);
120 while ((option =
tessopt(argc, argv,
"D" )) != EOF) {
130 unicharset_file_name = output_directory;
131 unicharset_file_name +=
"/";
132 unicharset_file_name += kUnicharsetFileName;
136 printf(
"Extracting unicharset from %s\n", argv[
tessoptind]);
138 FILE* box_file = fopen(argv[
tessoptind],
"rb");
139 if (box_file ==
NULL) {
140 printf(
"Cannot open box file %s\n", argv[
tessoptind]);
147 while (
ReadNextBox(&line_number, box_file, &unichar_string, &box)) {
155 printf(
"Wrote unicharset file %s.\n", unicharset_file_name.
string());
158 printf(
"Cannot save unicharset file %s.\n", unicharset_file_name.
string());
void unichar_insert(const char *const unichar_repr)
const char * string() const
bool ReadNextBox(int *line_number, FILE *box_file, STRING *utf8_str, TBOX *bounding_box)
int tessopt(inT32 argc, char *argv[], const char *arglist)
bool save_to_file(const char *const filename) const
| void set_properties |
( |
UNICHARSET * |
unicharset, |
|
|
const char *const |
c_string |
|
) |
| |
Definition at line 61 of file unicharset_extractor.cpp.
const UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
static int utf8_step(const char *utf8_str)
void set_isalpha(UNICHAR_ID unichar_id, bool value)
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)
void set_isupper(UNICHAR_ID unichar_id, bool value)
void set_other_case(UNICHAR_ID unichar_id, UNICHAR_ID other_case)
Definition at line 49 of file unicharset_extractor.cpp.
51 char *unichar = uch.utf8_str();
const UNICHAR_ID unichar_to_id(const char *const unichar_repr) const