Package: textgetter
textgettertextgetter v0.0.1This python package can be used for extracting text from PDF/TIF,jpg and png files.How to useget output as txt filesfromtextgetter.gettxtimportimg_txt_extractfromtextgetter.gettxtimporttif_txt_extractfromtextgetter.gettxtimportpdf_txt_extractif__name__=="__main__":# use img_txt_extract for extracting text from images like jpg,png etcimg_txt_extract('/home/user/test','/home/user/output',['jpeg','png'],ocr_path='C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe',verbose=True)# use tif_txt_extract for extracting text from tif filestif_txt_extract('/home/user/test','/home/user/output',verbose=True)# use pdf_txt_extract for extracting text from pdf filespdf_txt_extract('/home/user/test','/home/user/output',verbose=True)get output as docx filesfromtextgetter.getdocximportimg_txt_extractfromtextgetter.getdocximporttif_txt_extractfromtextgetter.getdocximportpdf_txt_extractif__name__=="__main__":# use img_txt_extract for extracting text from images like jpg,png etcimg_txt_extract('/home/user/test','/home/user/output',['jpeg','png'],verbose=True)# use tif_txt_extract for extracting text from tif filestif_txt_extract('/home/user/test','/home/user/output',ocr_path='C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe',verbose=True)# use pdf_txt_extract for extracting text from pdf filespdf_txt_extract('/home/user/test','/home/user/output',verbose=True)get output as csv filesfromtextgetter.getcsvimportimg_txt_extractfromtextgetter.getcsvimporttif_txt_extractfromtextgetter.getcsvimportpdf_txt_extractif__name__=="__main__":# use img_txt_extract for extracting text from images like jpg,png etcimg_txt_extract('/home/user/test','/home/user/output',['jpeg','png'],verbose=True)# use tif_txt_extract for extracting text from tif filestif_txt_extract('/home/user/test','/home/user/output',verbose=True)# use pdf_txt_extract for extracting text from pdf filespdf_txt_extract('/home/user/test','/home/user/output',ocr_path='C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe',verbose=True)get output as excel filesfromtextgetter.getexcelimportimg_txt_extractfromtextgetter.getexcelimporttif_txt_extractfromtextgetter.getexcelimportpdf_txt_extractif__name__=="__main__":# use img_txt_extract for extracting text from images like jpg,png etcimg_txt_extract('/home/user/test','/home/user/output',['jpeg','png'],verbose=True)# use tif_txt_extract for extracting text from tif filestif_txt_extract('/home/user/test','/home/user/output',verbose=True)# use pdf_txt_extract for extracting text from pdf filespdf_txt_extract('/home/user/test','/home/user/output',verbose=True)Argumentsimg_txt_extractinput_files_path - folder path for input files e.g., '/home/user/test'output_files_path - folder path for output files e.g., '/home/user/output'file_extensions - list of file extensions from input folder e.g., ['jpeg','png']ocr_path - path of tesseract ocr (Windows only) defualte.g., 'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe' , if linux ignore this argumentverbose - for printing logs e.g., True/False\tif_txt_extract and pdf_txt_extractinput_files_path - folder path for input files e.g., '/home/user/test'output_files_path - folder path for output files e.g., '/home/user/output'ocr_path - path of tesseract ocr (Windows only) e.g., 'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe', if linux ignore this argumentverbose - for printing logs e.g., True/FalseRequirementsThis package uses poppler for reading pdf files, for windows platform poppler is included in the package but for linux we have to install it manually.How to install popplerWe can download poppler frompopplerORWe can install poppler using below commandsudo apt-get install python-popplerHow to install tesseract ocrThis package uses tesseract for extracting text from files, we have to install it manually for both windows and linux platforms.Use thislinkto install tesseract ocr for Windows OSUse below command for Linux OSsudo apt install tesseract-ocr
sudo apt install libtesseract-dev