27 const char *filename) {
28 const int kDictDebugLevel = 1;
30 if (!dawg_file.
Open(filename,
nullptr)) {
31 tprintf(
"Could not open %s for reading.\n", filename);
34 tprintf(
"Loading word list from %s\n", filename);
37 if (!retval->
Load(&dawg_file)) {
38 tprintf(
"Could not read %s\n", filename);
49 void output_word(
const char *word) { fprintf(file_,
"%s\n", word); }
55static int WriteDawgAsWordlist(
const UNICHARSET &unicharset,
57 const char *outfile_name) {
58 FILE *out = fopen(outfile_name,
"wb");
60 tprintf(
"Could not open %s for writing.\n", outfile_name);
71int main(
int argc,
char *argv[]) {
72 tesseract::CheckSharedLibraryVersion();
74 if (argc > 1 && (!strcmp(argv[1],
"-v") || !strcmp(argv[1],
"--version"))) {
75 printf(
"%s\n", tesseract::TessBaseAPI::Version());
77 }
else if (argc != 4) {
78 tprintf(
"Print all the words in a given dawg.\n");
79 tprintf(
"Usage: %s -v | --version | %s <unicharset> <dawgfile> <wordlistfile>\n",
83 const char *unicharset_file = argv[1];
84 const char *dawg_file = argv[2];
85 const char *wordlist_file = argv[3];
88 tprintf(
"Error loading unicharset from %s.\n", unicharset_file);
92 if (dict ==
nullptr) {
93 tprintf(
"Error loading dictionary from %s.\n", dawg_file);
96 int retval = WriteDawgAsWordlist(unicharset, dict, wordlist_file);
_ConstTessMemberResultCallback_5_0< false, R, T1, P1, P2, P3, P4, P5 >::base * NewPermanentTessCallback(const T1 *obj, R(T2::*member)(P1, P2, P3, P4, P5) const, typename Identity< P1 >::type p1, typename Identity< P2 >::type p2, typename Identity< P3 >::type p3, typename Identity< P4 >::type p4, typename Identity< P5 >::type p5)
DLLSYM void tprintf(const char *format,...)
int main(int argc, char *argv[])
bool Open(const STRING &filename, FileReader reader)
bool load_from_file(const char *const filename, bool skip_fragments)
void iterate_words(const UNICHARSET &unicharset, TessCallback1< const WERD_CHOICE * > *cb) const
void output_word(const char *word)
WordOutputter(FILE *file)