I'm working with the code to summarize the text using BERT. I am stopped at the step "loading all pages of the pdf file to the program". My code below just loads only one page. Please help for the instruction. I am a new coder.

f= open('/content/Example.pdf', 'rb')
pdf = PdfFileReader(f)
page = pdf.getPage(6)
text = page.extractText()

Use getNumPages() and iterate over the pages to add to that text variable. Remember that 0 is page 1 of the PDF.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.