bugfix
This commit is contained in:
parent
91ed098680
commit
df664fd29c
@ -9,7 +9,7 @@ from bs4 import BeautifulSoup
|
||||
from pptx import Presentation
|
||||
from openpyxl import load_workbook
|
||||
import mobi
|
||||
import PyPDF2
|
||||
from pypdf import PdfReader
|
||||
import html2text
|
||||
|
||||
class MyMobiLoader:
|
||||
@ -48,16 +48,16 @@ class MyChmLoader:
|
||||
class MyPdfLoader:
|
||||
def __init__(self, file_path, **kw):
|
||||
self.filepath = file_path
|
||||
self.reader = None
|
||||
|
||||
def load(self):
|
||||
"""Reads the PDF file and returns all text as a single string."""
|
||||
text = ''
|
||||
with open(self.filepath, 'rb') as file:
|
||||
self.reader = PyPDF2.PdfReader(file)
|
||||
for page in self.reader.pages:
|
||||
text += page.extract_text() or ''
|
||||
return ' '.join(text.split('\t'))
|
||||
reader = PdfReader(self.filepath)
|
||||
pts = []
|
||||
for page in reader.pages:
|
||||
t = page.extract_text() or ''
|
||||
pts.append(' '.join(t.split('\t')))
|
||||
return ' '.join(pts)
|
||||
|
||||
class MyDocLoader:
|
||||
def __init__(self, file_path):
|
||||
|
Loading…
Reference in New Issue
Block a user