How to train Tesseract on multiple files at once?

2019-08-14 03:00发布

问题:

When I first trained Tesseract the tutorial I used showed a way to run the commands on each relevant file, but I can no longer find that.

How could I run this command for each file:

tesseract [lang].[fontname].exp[num].tif [lang].[fontname].exp[num] batch.nochop makebox

回答1:

For a quick and dirty loop, you can try:

for i in *.tif ; do tesseract $i $i.txt; done;

You can also do it with a find -iname ____ path to select from a subset of files.

If you want to really "parse" filenames, you may want to use a scripting language, or get your bash-foo out.