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

tesseract.js-core 2.2.0 (Tesseract 4.1.1) Whitelist not working #464

Closed
Marc-K-Plewka opened this issue Jul 13, 2020 · 1 comment
Closed

Comments

@Marc-K-Plewka
Copy link

Hello,
I was just trying to get the whitelist option setup with the scheduler. I already read the issues regarding the whitelist problem in Tesseract 4.0, but it should be fixed in version 4.1 and upwards. So my question is, how do I get the whitelist working again with the scheduler. Thanks in advance.

My current approach looks like this:

`

  //worker and scheduler setup called on start 
  (async () => {

                    try {
                        var basePath = path.join(__dirname,'../');
                        for (i = 0; i < 4; i++) {
                            var worker = createWorker({ langPath: basePath});
                            await worker.load();
                            await worker.loadLanguage('deu');
                            await worker.initialize('deu');
                            scheduler.addWorker(worker);

                        }
                    }
                    catch (err) {
                        console.log(err);
                    }
                })();

    //actual tesseract request called on file upload request
    //in reality I have a switch here to set different whitelists based on the incoming file
    let options = { tessedit_char_whitlist: '0123456789' };
    (async () => {
                    try {
                        const { data: { text } } = await scheduler.addJob('recognize', filePath, options);
                        console.log(text);
                        textRes = text;
                        res.send(textRes);
                    }
                     catch (ew1) {
                        throw ew1;
                    }
                })();

`

@Balearica
Copy link
Member

Closing as the master branch of tesseract.js-core was updated to use Tesseract 5, which does not have this issue (naptha/tesseract.js-core#18).

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

No branches or pull requests

2 participants