我在我的angular代码中使用了tessearct.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库的原因。
发布于 2021-10-26 08:44:36
你可以在version (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);
}https://stackoverflow.com/questions/69719863
复制相似问题