次のように、slate3k を使用して、pdf ドキュメントの最初の数ページから情報を抽出しようとしています。
for i in range(table.shape[0]):
print(i)
download_path = pdf_dir + '/'+ table.iloc[i,6]
if(path.exists(download_path)):
if download_path.endswith('.pdf'):
file = open(download_path,'rb')
doc = slate3k.PDF(file)
doc = ' '.join(doc[:2])
doc = re.sub("\n","",doc)
そして、次のエラーが表示されます。
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-474429c993a7> in <module>
12 if download_path.endswith('.pdf'):
13 file = open(download_path,'rb')
---> 14 doc = slate3k.PDF(file)
15 doc = ' '.join(doc[:2])
16 doc = re.sub("\n","",doc)
~\Anaconda3\lib\site-packages\slate3k\classes.py in __init__(self, file, password, just_text, check_extractable, char_margin, line_margin, word_margin)
57
58 if PYTHON_3:
---> 59 self.doc = PDFDocument()
60 self.parser.set_document(self.doc)
61 self.doc.set_parser(self.parser)
TypeError: __init__() missing 1 required positional argument: 'parser'
誰でもエラーが何であるかを理解するのを手伝ってもらえますか? そして、どうすればこの問題を解決できますか?