I want to parse text from an image, the image conatins arabic and english both. I am using tesseract.js to parse the text from the image but keep getting an error "langsArr.map is not a function"
Below is the code
const { createWorker } = require("tesseract.js");
async function recognizeImage() {
const worker = createWorker({
workerPath:
"https://cdn.jsdelivr.net/npm/[email protected]/dist/worker.min.js",
langPath: "./tessdata",
corePath: "https://cdn.jsdelivr.net/npm/[email protected]",
});
await worker.load();
// Replace 'eng+ara' with the specific languages you want to recognize
await worker.loadLanguage("eng", "ara");
await worker.initialize(\["eng", "ara"\]);
const {
data: { text },
} = await worker.recognize("./receipt images/loremArabic.png");
console.log("Recognized text:", text);
await worker.terminate();
}
recognizeImage().catch((err) =\> console.error(err.message));
Libraries versions I am using are "tesseract.js": "^5.0.3", "tesseract.js-core": "^5.0.0",