Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ocr-document-classification

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocr-document-classification - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

22

dist/index.js

@@ -65,2 +65,14 @@ "use strict";

const documentDictionary = { ...defaultDocumentDictionary, ...customDocumentDictionary };
let progress = 0;
const worker = await Tesseract.createWorker("nor+eng", 2, {
logger: (m) => {
if (m.status === "recognizing text") {
progress = m.progress * 0.8;
if (onProgress) onProgress(progress);
}
}
});
await worker.setParameters({
tessedit_pageseg_mode: Tesseract.PSM.AUTO_OSD
});
const reader = new FileReader();

@@ -71,11 +83,5 @@ return new Promise((resolve, reject) => {

try {
let progress = 0;
if (onProgress) onProgress(progress);
const { data: { text } } = await Tesseract.recognize(imageDataUrl, "nor+eng", {
logger: (m) => {
if (m.status === "recognizing text") {
progress = m.progress * 0.8;
if (onProgress) onProgress(progress);
}
}
const { data: { text } } = await worker.recognize(imageDataUrl, {
rotateAuto: true
});

@@ -82,0 +88,0 @@ const targetWords = Array.from(new Set(Object.values(documentDictionary).flat(2)));

{
"name": "ocr-document-classification",
"version": "1.0.3",
"version": "1.0.4",
"description": "Document classification using tesseract.js and string-similarity-js.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -44,14 +44,12 @@ # OCR Document Classification

```javascript
const defaultDocumentDictionary: documentDictionary = {
'BEVIS PÅ FØRSTEGANGSTJENESTE': [
['førstegangstjeneste', 'bevis', 'avtjent'],
['attest', 'førstegangstjeneste'],
],
POLITIATTEST: [
['politiattest', 'politidistrikt'],
['police certificate'],
],
KOMPETANSEBEVIS: [['omfatter', 'opplæring', 'utdanningsprogram']],
LEGEERKLÆRING: [['legeerklæring', 'fødselsnummer']],
};
const defaultDocumentDictionary: documentDictionary = {
BEVISPAFORSTEGANGSTJENESTE: [
['førstegangstjeneste', 'bevis', 'avtjent'],
['attest', 'førstegangstjeneste'],
['fullført', 'førstegangstjeneste'],
],
POLITIATTEST: [['politiattest', 'politidistrikt'], ['police certificate']],
KOMPETANSEBEVIS: [['omfatter', 'opplæring', 'utdanningsprogram']],
LEGEERKLERING: [['legeerklæring', 'fødselsnummer']],
}
```

@@ -58,0 +56,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc