Pure Javascript OCR for more than 100 Languages 📖🎉🖥
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
935 B

const { createWorker } = Tesseract;
let worker;
before(async function cb() {
5 years ago
this.timeout(0);
worker = await createWorker(OPTIONS);
5 years ago
});
5 years ago
describe('detect()', async () => {
it('should detect OSD', () => {
[
5 years ago
{ name: 'cosmic.png', ans: { script: 'Latin' } },
].forEach(async ({ name, ans: { script } }) => {
await worker.loadLanguage('osd');
await worker.initialize('osd');
const { data: { script: s } } = await worker.detect(`${IMAGE_PATH}/${name}`);
5 years ago
expect(s).to.be(script);
});
5 years ago
}).timeout(TIMEOUT);
});
describe('detect()', async () => {
it('should detect OSD (simplified interface)', () => {
[
{ name: 'cosmic.png', ans: { script: 'Latin' } },
].forEach(async ({ name, ans: { script } }) => {
const { data: { script: s } } = await Tesseract.detect(`${IMAGE_PATH}/${name}`, undefined, OPTIONS);
expect(s).to.be(script);
});
}).timeout(TIMEOUT);
});