#include "classify.h"
#include "commontraining.h"
#include "dawg.h"
#include "dict.h"
#include <tesseract/helpers.h>
#include <tesseract/serialis.h>
#include "trie.h"
#include "unicharset.h"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 31 of file wordlist2dawg.cpp.
32 tesseract::CheckSharedLibraryVersion();
34 if (argc > 1 && (!strcmp(argv[1],
"-v") || !strcmp(argv[1],
"--version"))) {
37 }
else if (!(argc == 4 || (argc == 5 && strcmp(argv[1],
"-t") == 0) ||
38 (argc == 6 && strcmp(argv[1],
"-r") == 0))) {
39 printf(
"Usage: %s -v | --version |\n"
40 " %s [-t | -r [reverse policy] ] word_list_file"
41 " dawg_file unicharset_file\n", argv[0], argv[0]);
46 if (argc == 5) ++argv_index;
52 sscanf(argv[++argv_index],
"%d", &tmp_int);
53 reverse_policy = static_cast<tesseract::Trie::RTLReversePolicy>(tmp_int);
54 tprintf(
"Set reverse_policy to %s\n",
57 const char* wordlist_filename = argv[++argv_index];
58 const char* dawg_filename = argv[++argv_index];
59 const char* unicharset_file = argv[++argv_index];
60 tprintf(
"Loading unicharset from '%s'\n", unicharset_file);
62 tprintf(
"Failed to load unicharset from '%s'\n", unicharset_file);
67 if (argc == 4 || argc == 6) {
72 tprintf(
"Reading word list from '%s'\n", wordlist_filename);
73 if (!trie.read_and_add_word_list(wordlist_filename, unicharset,
75 tprintf(
"Failed to add word list from '%s'\n", wordlist_filename);
78 tprintf(
"Reducing Trie to SquishedDawg\n");
80 if (dawg !=
nullptr && dawg->
NumEdges() > 0) {
81 tprintf(
"Writing squished DAWG to '%s'\n", dawg_filename);
84 tprintf(
"Dawg is empty, skip producing the output file\n");
87 }
else if (argc == 5) {
88 tprintf(
"Loading dawg DAWG from '%s'\n", dawg_filename);
94 tprintf(
"Checking word list from '%s'\n", wordlist_filename);
95 words.check_for_words(wordlist_filename, unicharset,
true);
97 tprintf(
"Invalid command-line options\n");