29 const char *filename) {
30 const int kDictDebugLevel = 1;
32 if (!dawg_file.
Open(filename,
nullptr)) {
33 tprintf(
"Could not open %s for reading.\n", filename);
36 tprintf(
"Loading word list from %s\n", filename);
39 if (!retval->
Load(&dawg_file)) {
40 tprintf(
"Could not read %s\n", filename);
51 void output_word(
const char *word) { fprintf(file_,
"%s\n", word); }
57 static int WriteDawgAsWordlist(
const UNICHARSET &unicharset,
59 const char *outfile_name) {
60 FILE *out = fopen(outfile_name,
"wb");
62 tprintf(
"Could not open %s for writing.\n", outfile_name);
73 int main(
int argc,
char *argv[]) {
74 tesseract::CheckSharedLibraryVersion();
76 if (argc > 1 && (!strcmp(argv[1],
"-v") || !strcmp(argv[1],
"--version"))) {
79 }
else if (argc != 4) {
80 tprintf(
"Print all the words in a given dawg.\n");
81 tprintf(
"Usage: %s -v | --version | %s <unicharset> <dawgfile> <wordlistfile>\n",
85 const char *unicharset_file = argv[1];
86 const char *dawg_file = argv[2];
87 const char *wordlist_file = argv[3];
90 tprintf(
"Error loading unicharset from %s.\n", unicharset_file);
94 if (dict ==
nullptr) {
95 tprintf(
"Error loading dictionary from %s.\n", dawg_file);
98 int retval = WriteDawgAsWordlist(unicharset, dict, wordlist_file);
_ConstTessMemberResultCallback_0_0< false, R, T1 >::base * NewPermanentTessCallback(const T1 *obj, R(T2::*member)() const)
int main(int argc, char *argv[])
DLLSYM void tprintf(const char *format,...)
bool Open(const STRING &filename, FileReader reader)
void iterate_words(const UNICHARSET &unicharset, TessCallback1< const WERD_CHOICE *> *cb) const
void output_word(const char *word)
static const char * Version()
bool load_from_file(const char *const filename, bool skip_fragments)
WordOutputter(FILE *file)