What are the most important topics that I should be studying for my exam
My subjects are anatomy biochemistry and physiology
These are the question asked in the past years .Can you divide it by each subject and how many times a question is repeated
import os, json import pdfplumber base = "/home/daytona/workspace/attachments/501c3aad-f7e1-497c-afd3-7bb8b7978b8d/" pdfs = [f for f in os.listdir(base) if f.endswith(".pdf")] pdfs.sort() all_text = {} for pdf in pdfs: path = os.path.join(base, pdf) text = "" try: with pdfplumber.open(path) as p: for page in p.pages: t = page.extract_text() if t: text += t + "\n" except Exception as e: text = f"ERROR: {e}" all_text[pdf] = text print(f"=== {pdf} ({len(text)} chars) ===") print(text[:500]) print("---")
python3 -c " import os, pdfplumber base = '/home/daytona/workspace/attachments/501c3aad-f7e1-497c-afd3-7bb8b7978b8d/' pdfs = sorted([f for f in os.listdir(base) if f.endswith('.pdf')]) for pdf in pdfs: path = os.path.join(base, pdf) text = '' try: with pdfplumber.open(path) as p: for page in p.pages: t = page.extract_text() if t: text += t + '\n' except Exception as e: text = 'ERROR: ' + str(e) print('=== ' + pdf + ' (' + str(len(text)) + ' chars) ===') print(text[:800]) print('---') "
python3 -c " import subprocess result = subprocess.run(['which', 'tesseract'], capture_output=True, text=True) print('tesseract:', result.stdout.strip()) result2 = subprocess.run(['which', 'pdftoppm'], capture_output=True, text=True) print('pdftoppm:', result2.stdout.strip()) result3 = subprocess.run(['python3', '-c', 'import pytesseract; print(pytesseract.__version__)'], capture_output=True, text=True) print('pytesseract:', result3.stdout.strip(), result3.stderr.strip()) "
python3 -c " import os, subprocess, pytesseract from PIL import Image import io base = '/home/daytona/workspace/attachments/501c3aad-f7e1-497c-afd3-7bb8b7978b8d/' out_dir = '/home/daytona/workspace/ocr_output/' os.makedirs(out_dir, exist_ok=True) pdfs = sorted([f for f in os.listdir(base) if f.endswith('.pdf')]) for pdf in pdfs: path = os.path.join(base, pdf) out_prefix = os.path.join(out_dir, pdf.replace('.pdf','').replace(' ','_')) # convert PDF pages to images subprocess.run(['pdftoppm', '-r', '200', path, out_prefix], check=True) print('Converted: ' + pdf) " 2>&1
BASE="/home/daytona/workspace/attachments/501c3aad-f7e1-497c-afd3-7bb8b7978b8d/" && python3 -c " import subprocess, os base = '/home/daytona/workspace/attachments/501c3aad-f7e1-497c-afd3-7bb8b7978b8d/' pdfs = sorted([f for f in os.listdir(base) if f.endswith('.pdf')]) for pdf in pdfs: r = subprocess.run(['pdfinfo', os.path.join(base, pdf)], capture_output=True, text=True) lines = [l for l in r.stdout.split('\n') if 'Pages' in l] print(pdf[:50], ':', lines) "
mkdir -p /home/daytona/workspace/ocr_output && python3 << 'PYEOF' import os, subprocess, pytesseract from PIL import Image import glob base = '/home/daytona/workspace/attachments/501c3aad-f7e1-497c-afd3-7bb8b7978b8d/' out_dir = '/home/daytona/workspace/ocr_output/' pdfs = sorted([f for f in os.listdir(base) if f.endswith('.pdf')]) # Process first 3 PDFs as a test for pdf in pdfs[:3]: path = os.path.join(base, pdf) safe = pdf.replace('.pdf','').replace(' ','_') img_prefix = out_dir + safe # Convert at low res for speed subprocess.run(['pdftoppm', '-r', '150', '-jpeg', path, img_prefix], check=True, timeout=60) imgs = sorted(glob.glob(img_prefix + '-*.jpg') + glob.glob(img_prefix + '-*.ppm')) text = '' for img in imgs: t = pytesseract.image_to_string(Image.open(img), config='--psm 6') text += t + '\n' txt_path = out_dir + safe + '.txt' with open(txt_path, 'w') as f: f.write(text) print(f'Done: {pdf} -> {len(text)} chars') print('Batch 1 complete') PYEOF
PDF="/home/daytona/workspace/attachments/501c3aad-f7e1-497c-afd3-7bb8b7978b8d/Anatomy Physiology Biochemistry_0002.pdf" && mkdir -p /home/daytona/workspace/ocr_output && pdftoppm -r 120 -jpeg "$PDF" /home/daytona/workspace/ocr_output/test && ls /home/daytona/workspace/ocr_output/
python3 -c " import pytesseract from PIL import Image import time imgs = ['/home/daytona/workspace/ocr_output/test-' + str(i) + '.jpg' for i in range(1,6)] start = time.time() text = '' for img in imgs: t = pytesseract.image_to_string(Image.open(img), config='--psm 6 --oem 1') text += t + '\n' elapsed = time.time() - start print(f'5 pages OCR took {elapsed:.1f}s') print('SAMPLE:') print(text[:2000]) "
cat /home/daytona/workspace/ocr_output/Anatomy_Physiolofy_Biochemistry_0001.txt | head -100
python3 << 'PYEOF' import pytesseract, glob, os, time from PIL import Image out_dir = '/home/daytona/workspace/ocr_output/' # Map prefixes to output txt files sets = { 'Anatomy_Physiology_Biochemistry-': 'APB_main.txt', 'Anatomy_Physiology_Biochemistry_0001_10-': 'APB_10.txt', 'Anatomy_Physiology_Biochemistry_0001_12-': 'APB_12.txt', 'test-': 'APB_0002.txt', # 5-page test PDF } for prefix, outfile in sets.items(): out_path = out_dir + outfile if os.path.exists(out_path): print(f'Already exists: {outfile}') continue imgs = sorted(glob.glob(out_dir + prefix + '*.jpg') + glob.glob(out_dir + prefix + '*.ppm')) if not imgs: print(f'No images for prefix: {prefix}') continue print(f'Processing {len(imgs)} images for {outfile}...') text = '' for img in imgs: t = pytesseract.image_to_string(Image.open(img), config='--psm 6 --oem 1') text += t + '\n' with open(out_path, 'w') as f: f.write(text) print(f' Saved {outfile} ({len(text)} chars)') print('DONE') PYEOF