init commit
This commit is contained in:
13
parse_text/read_pdf.py
Normal file
13
parse_text/read_pdf.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import fitz
|
||||
import sys
|
||||
|
||||
def read_PDF(path):
|
||||
with fitz.open(path) as doc:
|
||||
text = ""
|
||||
for page in doc:
|
||||
text += page.get_text()
|
||||
with open(f'../recipe_text/{text[:20]}.txt', 'w') as f:
|
||||
f.write(text)
|
||||
|
||||
read_PDF('../recipes/sample_recipe.pdf')
|
||||
sys.stdout.flush()
|
||||
Reference in New Issue
Block a user