AIcareerCoach / resume_parser.py
Hyma7's picture
Upload 7 files
5f81bcf verified
raw
history blame contribute delete
457 Bytes
import PyPDF2
import re
def extract_text_from_pdf(pdf_file):
text = ""
reader = PyPDF2.PdfReader(pdf_file)
for page in reader.pages:
text += page.extract_text()
return text
def clean_text(text):
text = re.sub(r'\s+', ' ', text)
text = text.strip()
return text
def parse_resume(pdf_file):
raw_text = extract_text_from_pdf(pdf_file)
cleaned_text = clean_text(raw_text)
return cleaned_text