-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PrintVariables produces config file that ReadConfigFile does not properly read #3943
Comments
We don't want to do this because that function is used by the command line tool and we need the descriptions in that case. Lines 721 to 724 in 0daf18c
|
@amitdo Good point. How about adding an option to |
How about using:
or:
in: tesseract/src/ccutil/params.cpp Line 164 in 60fd2b4
|
The regression was added in c51691f in 2014, a long time ago, so all relevant releases are affected. |
Obviously the argument If |
I think the ability to dump the user's current parameters and easily restore them later is useful (we're implementing a feature in Tesseract.js that tries to do this using Adding a new function that writes a config file without the info text (suggested in the PR #3947) seems like an easy and effective solution. I looked into whether |
Related issue: #3260 |
|
This comment and my comments below it are also related to this issue. |
Okay, if we are confident that VALUE will never include tabs, then I can edit |
@stweil Do you believe it's safe to assume that tabs will not be used as parameter values (so it is safe for |
I created a new PR (#4074) based on @stweil's idea to implement by adding a new function in #3947 (review). |
Expected Behavior:
The API function
PrintVariables
prints current parameters to a file, andReadConfigFile
reads parameters from a file. Intuitively,ReadConfigFile
should be able to read the files thatPrintVariables
writes. This is explicitly assumed within theProcessPage
function, where these functions are used together to "Save current config variables before switching modes" and then "Restore saved config variables".tesseract/src/api/baseapi.cpp
Lines 1293 to 1306 in a873553
Current Behavior:
Unfortunately, this does not currently work properly. The issue is that
PrintVariables
prints parameter descriptions alongside key/value pairs (e.g.chs_trailing_punct1 ).,;:?! 1st Trailing punctuation
), andReadConfigFile
reads the description as a value (for string parameters). An example showing this is below.This returns the following:
The impact of this is:
ProcessPage
does not work correctly when used withretry_config
ProcessPage
attempts to do)Suggested Fix:
The simplest solution would be to remove the descriptions from the
PrintVariables
output (or at least hide that behavior behind an option). I can write a PR if others agree this makes sense. EditingReadConfigFile
to ignore the descriptions is likely also possible, but could be higher effort.Environment
Tesseract Version: 5.2.0
Commit Number: 15200c6
Platform: Linux ubuntu 5.15.0-43-generic
The text was updated successfully, but these errors were encountered: