You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constants.OCR_AGENTS={GOOGLE_VISION: "google-vision"// Add new OCR library here};
Implementation changes
src/ocr/google-vision/index.ts
importYourLibraryfrom"./your-library-goes-here";// Make strategy for new documentOCR[Constants.OCR_AGENTS.YOUR_LIBRARY]={extractDocumentText: YourLibrary.extractDocumentText};
src/ocr/your-library-goes-here/index.ts
Your library should expose a function called extractDocumentText.
For function contract check src/interfaces/OCR.ts
For reference please check the source code of google-vision integration.
import{ExtractDocumentTypeRequest,ExtractDocumentTypeResponse}from"../../interfaces/OCR";// ******************************************************* //// Logic for API handlers starts here //// ******************************************************* //YourLibrary.extractDocumentText=async(params: ExtractDocumentTypeRequest): Promise<ExtractDocumentTypeResponse>=>{
....
....
....return{raw_text: _.split(text,"\n")};};// ******************************************************* //// Logic for API handlers ends here //// ******************************************************* //exportdefaultYourLibrary;