Merge pull request #2548 from zhuangzhuang/fix_tesstrain_py_error

fix tesstrain.py error
This commit is contained in:
Egor Pugin 2019-07-08 11:25:41 +03:00 committed by GitHub
commit 84ffcc0d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -380,7 +380,7 @@ def phase_I_generate_image(ctx, par_factor=None):
# for tesseract to recognize during training. Take only the ngrams whose
# combined weight accounts for 95% of all the bigrams in the language.
lines = pathlib.Path(ctx.bigram_freqs_file).read_text(encoding="utf-8").split("\n")
records = (line.split(" ") for line in lines)
records = (line.split() for line in lines)
p = 0.99
ngram_frac = p * sum(int(rec[1]) for rec in records if len(rec) >= 2)