ocr-document-classification
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,3 +5,3 @@ type documentDictionary = { | ||
declare function classifyDocument(file: File, onProgress: (progress: number) => void, customDocumentDictionary?: documentDictionary): Promise<{ | ||
declare function classifyDocument(file: File, onProgress?: (progress: number) => void, customDocumentDictionary?: documentDictionary): Promise<{ | ||
classification: string; | ||
@@ -8,0 +8,0 @@ text: string; |
@@ -73,3 +73,3 @@ "use strict"; | ||
let progress = 0; | ||
onProgress(progress); | ||
if (onProgress) onProgress(progress); | ||
const { data: { text } } = await Tesseract.recognize(imageDataUrl, "nor+eng", { | ||
@@ -79,3 +79,3 @@ logger: (m) => { | ||
progress = m.progress * 0.8; | ||
onProgress(progress); | ||
if (onProgress) onProgress(progress); | ||
} | ||
@@ -87,6 +87,6 @@ } | ||
progress = 0.9; | ||
onProgress(progress); | ||
if (onProgress) onProgress(progress); | ||
const classification = determineClassification(targetWordsFound, documentDictionary); | ||
progress = 1; | ||
onProgress(progress); | ||
if (onProgress) onProgress(progress); | ||
resolve({ classification, text }); | ||
@@ -93,0 +93,0 @@ } catch (err) { |
{ | ||
"name": "ocr-document-classification", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Document classification using tesseract.js and string-similarity-js.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12073