Fix code for generating config files#4074
Fix code for generating config files#4074Balearica wants to merge 2 commits intotesseract-ocr:mainfrom
Conversation
|
Can you please add it also to C-API? |
I added corresponding functions to the C API. |
Do we really need any new API function not only for C++ but also for C? |
|
Why C and C++ API should not be synchronized (providing the same features)? |
|
Each additional API creates some costs (implementation, maintenance, code size). And is there still a need for a C API? Maybe we should even consider dropping the whole C API in a future version 6. If a C API for a new function is really missing it can be added any time later. |
|
IMO costs are minimal for CAPI. I see no benefit in removing it. |
|
What about keeping the API unchanged, but fixing the API regression (introduced in commit c51691f)?
That is my preferred solution because I try to minimize API changes. |
|
@Balearica, if you want to update your pull request with a new implementation which avoids API changes, it would be nice if you could review your author information. Many projects refuse pull requests without a valid real name for the author, and I think that would be good for Tesseract contributions, too. |
Resolves #3943, see that issue for a full explanation and previous discussion on this issue.
In short, the function
ParamUtils::PrintParamspreviously created a machine-readable config file with parameter names and values. It was then edited to add human-readable descriptions to each of the parameters. While this change undoubtedly made the results easier for users to interpret, the resulting files no longer functioned properly as config files. This (1) broke the parts of the code that assumedParamUtils::PrintParamscreated machine-readable config files and (2) meant there was no longer an API function for creating machine-readable config files using the current settings.This PR fixes both issues:
ParamUtils::PrintParamsto specify whether descriptions of parameters should be printedParamUtils::PrintParamsis inarguably being used with the intent of creating a machine-readable config file, the parameter is set totrueDumpVariableshas been added, which creates config files (the old behavior ofPrintVariables)