Skip to content
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

Use python script for generating list.eval and list.train. #379

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

zdenop
Copy link
Contributor

@zdenop zdenop commented Mar 10, 2024

This decreases dependency on bc program and solves the problem with EOL on Windows.

This decreases dependency on `bc` program and solves the problem with EOL on Windows.
Comment on lines +24 to +28
with open(train_list, 'w', newline='\n') as f1, open(
eval_list, 'w', newline='\n'
) as f2:
f1.writelines(lines[:split_point])
f2.writelines(lines[split_point:])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with open(train_list, 'w', newline='\n') as f1, open(
eval_list, 'w', newline='\n'
) as f2:
f1.writelines(lines[:split_point])
f2.writelines(lines[split_point:])
with open(train_list, 'w', newline='\n') as f:
f.writelines(lines[:split_point])
with open(eval_list, 'w', newline='\n') as f:
f.writelines(lines[split_point:])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks simpler like that. Is there a reason to implement it differently?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I see modern examples and tutorials on the internet: if you open more files with with they are always combined into one as in my PR.
Also, python linters do not like single-letter (f) variables and for readability, I suggest using different names for eval and train files.

@stweil stweil merged commit b72e01c into tesseract-ocr:main Mar 23, 2024
2 checks passed
@stweil
Copy link
Member

stweil commented Mar 23, 2024

Thank you.

@zdenop zdenop deleted the split branch March 26, 2024 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants