Skip to content

Commit

Permalink
Showing 5 changed files with 33 additions and 18 deletions.
11 changes: 6 additions & 5 deletions training/ambiguous_words.cpp
Original file line number Diff line number Diff line change
@@ -21,8 +21,6 @@
///////////////////////////////////////////////////////////////////////
//

#include <stdio.h>

#include "baseapi.h"
#include "commontraining.h" // CheckSharedLibraryVersion
#include "helpers.h"
@@ -34,9 +32,12 @@ int main(int argc, char** argv) {
tesseract::CheckSharedLibraryVersion();

// Parse input arguments.
if (argc != 4 && (argc != 6 || strcmp(argv[1], "-l") != 0)) {
printf("Usage: %s [-l lang] tessdata_dir wordlist_file"
" output_ambiguous_wordlist_file\n", argv[0]);
if (argc > 1 && !strcmp(argv[1], "--version")) {
printf("%s\n", tesseract::TessBaseAPI::Version());
return 0;
} else if (argc != 4 && (argc != 6 || strcmp(argv[1], "-l") != 0)) {
printf("Usage: %s --version | %s [-l lang] tessdata_dir wordlist_file"
" output_ambiguous_wordlist_file\n", argv[0], argv[0]);
return 1;
}
int argv_offset = 0;
5 changes: 4 additions & 1 deletion training/combine_tessdata.cpp
Original file line number Diff line number Diff line change
@@ -70,7 +70,10 @@ int main(int argc, char **argv) {

int i;
tesseract::TessdataManager tm;
if (argc == 2) {
if (argc > 1 && !strcmp(argv[1], "--version")) {
printf("%s\n", tesseract::TessBaseAPI::Version());
return 0;
} else if (argc == 2) {
printf("Combining tessdata files\n");
STRING lang = argv[1];
char* last = &argv[1][strlen(argv[1])-1];
9 changes: 6 additions & 3 deletions training/dawg2wordlist.cpp
Original file line number Diff line number Diff line change
@@ -75,10 +75,13 @@ int WriteDawgAsWordlist(const UNICHARSET &unicharset,
int main(int argc, char *argv[]) {
tesseract::CheckSharedLibraryVersion();

if (argc != 4) {
if (argc > 1 && !strcmp(argv[1], "--version")) {
printf("%s\n", tesseract::TessBaseAPI::Version());
return 0;
} else if (argc != 4) {
tprintf("Print all the words in a given dawg.\n");
tprintf("Usage: %s <unicharset> <dawgfile> <wordlistfile>\n",
argv[0]);
tprintf("Usage: %s --version | %s <unicharset> <dawgfile> <wordlistfile>\n",
argv[0], argv[0]);
return 1;
}
const char *unicharset_file = argv[1];
14 changes: 9 additions & 5 deletions training/merge_unicharsets.cpp
Original file line number Diff line number Diff line change
@@ -23,11 +23,15 @@
int main(int argc, char** argv) {
tesseract::CheckSharedLibraryVersion();

// Print usage
if (argc < 4) {
printf("Usage: %s unicharset-in-1 ... unicharset-in-n unicharset-out\n",
argv[0]);
exit(1);
if (argc > 1 && !strcmp(argv[1], "--version")) {
printf("%s\n", tesseract::TessBaseAPI::Version());
return 0;
} else if (argc < 4) {
// Print usage
printf("Usage: %s --version |\n"
" %s unicharset-in-1 ... unicharset-in-n unicharset-out\n",
argv[0], argv[0]);
return 1;
}

UNICHARSET input_unicharset, result_unicharset;
12 changes: 8 additions & 4 deletions training/wordlist2dawg.cpp
Original file line number Diff line number Diff line change
@@ -33,10 +33,14 @@
int main(int argc, char** argv) {
tesseract::CheckSharedLibraryVersion();

if (!(argc == 4 || (argc == 5 && strcmp(argv[1], "-t") == 0) ||
(argc == 6 && strcmp(argv[1], "-r") == 0))) {
printf("Usage: %s [-t | -r [reverse policy] ] word_list_file"
" dawg_file unicharset_file\n", argv[0]);
if (argc > 1 && !strcmp(argv[1], "--version")) {
printf("%s\n", tesseract::TessBaseAPI::Version());
return 0;
} else if (!(argc == 4 || (argc == 5 && strcmp(argv[1], "-t") == 0) ||
(argc == 6 && strcmp(argv[1], "-r") == 0))) {
printf("Usage: %s --version |\n"
" %s [-t | -r [reverse policy] ] word_list_file"
" dawg_file unicharset_file\n", argv[0], argv[0]);
return 1;
}
tesseract::Classify *classify = new tesseract::Classify();

0 comments on commit 0998bcf

Please sign in to comment.