<jupyter_start><jupyter_text>Uber bills parsing - Pdf file parsing<jupyter_code>import os
dir_Path = 'C://Users//VK//AI//ML//NLP//NLP_Amn//Project-2_PDF_Prasing_Amn//Dummy_bills//'
os.chdir(dir_Path)
os.getcwd()
os.listdir()
import PyPDF2

file_List = os.listdir()
 
for file_Name in file_List:
 
    f = open(dir_Path+file_Name, 'rb')
    reader = PyPDF2.PdfFileReader(f)
    file_contents = reader.getPage(0).extractText().split('\n')
    invoice_no = ""
    date = ""
    amount = ""
 
    for i in range(len(file_contents)):
        if file_contents[i].find("Invoice Number") != -1:
            invoice_no = file_contents[i].split(': ')[1]
        if file_contents[i].find("Invoice Date") != -1:
            date = file_contents[i].split(': ')[1]
        if file_contents[i].find("Gross Amount") != -1:
            amount = file_contents[i+1].split(' ')[0]
 
    print(invoice_no + ", " + date + ", " + amount)
    f.close()<jupyter_output>, , 
, , 
, , 
, , 
, , 
, ,<jupyter_text>Word file parsing<jupyter_code>import docx2txt
import os
dir_Path = 'C://Users//VK//AI//ML//NLP//NLP_Amn//Project-2_PDF_Prasing_Amn//'
os.chdir(dir_Path)
 
# read in word file
result = docx2txt.process("Master_Bill_format.docx")
result<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17346123101518784, 'fraction_numerical': 0.011191047162270184, 'mean_word_length': 3.3929824561403508, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '477714', 'license': 'Unlicense', 'n_tokens_mistral': 507, 'n_tokens_neox': 496, 'n_words': 75, 'path': 'AMAN_NLP_VIMP-CODE/Project-2_PDF_Prasing_Amn/NLP Data Import Part 2 - Document Parsing_Amn.ipynb', 'repo_name': 'vitthalkcontact/NLP', 'size': '1251'}