我在我的angular代码中使用tessearcts .js库。我想保留空白,保留缩进。怎么做呢?目前,我正在使用这段代码来完成它。
async doOCR {
const worker = createWorker({
logger: m => console.log(m),
});
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
const value = await worker.recognize(this.selectedFile);
}
我正在寻找一种方法来做它只在客户端,这就是为什么不使用它的python库。
您可以在版本(3.04), they have added the
preserve_interword_spaces '之后尝试一下。你可以试试这个,看看是否有效:
async doOCR {
const worker = createWorker({
logger: m => console.log(m),
});
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
// there is no proper documentation, but they have added this flag
// to run it as a command
await worker.setParameters({
preserve_interword_spaces: 1,
});
const value = await worker.recognize(this.selectedFile);
}