MandarBhalerao commited on
Commit
0047282
1 Parent(s): e5db578

Initial commit

Browse files
app/generating_prompts_from_resume.py DELETED
@@ -1,65 +0,0 @@
1
- import pdfplumber
2
- import re
3
-
4
- def extract_text_from_pdf(pdf_path):
5
- with pdfplumber.open(pdf_path) as pdf:
6
- pages = [page.extract_text() for page in pdf.pages]
7
- all_text = "\n".join(pages) if pages else ""
8
- print(all_text)
9
- return all_text
10
-
11
- def extract_resume_details(resume_text):
12
- # Example regex patterns to extract different parts of the resume
13
- name_match = re.search(r"Name:\s*(.*)", resume_text)
14
- name = name_match.group(1).strip() if name_match else "Name not found"
15
-
16
- education_match = re.search(r"Education:(.*?)(?=\nExperience:)", resume_text, re.DOTALL)
17
- education = education_match.group(1).strip() if education_match else "Education details not found"
18
-
19
- experience_match = re.search(r"Experience:(.*?)(?=\nProjects:)", resume_text, re.DOTALL)
20
- experience = experience_match.group(1).strip() if experience_match else "Experience details not found"
21
-
22
- projects_match = re.search(r"Projects:(.*?)(?=\nSkills:)", resume_text, re.DOTALL)
23
- projects = projects_match.group(1).strip() if projects_match else "Project details not found"
24
-
25
- skills_match = re.search(r"Skills:(.*)", resume_text)
26
- skills = skills_match.group(1).strip() if skills_match else "Skills details not found"
27
-
28
- achievements_match = re.search(r"Achievements:(.*)", resume_text)
29
- achievements = achievements_match.group(1).strip() if achievements_match else "Achievements not found"
30
-
31
- return {
32
- "name": name,
33
- "education": education,
34
- "experience": experience,
35
- "projects": projects,
36
- "skills": skills,
37
- "achievements": achievements
38
- }
39
-
40
- def generate_cold_email(details):
41
- return f"""
42
- You are {details['name']}, a graduate from {details['education']}. Your professional experience includes {details['experience']}. You have led projects such as {details['projects']} and are skilled in {details['skills']}. You have also achieved {details['achievements']}.
43
-
44
- Your task is to write a cold email to a potential employer or client, showcasing your skills and experiences detailed above. Mention your hands-on experience with technologies and how you can contribute to solving real-world problems.
45
-
46
- Remember, you are {details['name']}, ready to make a significant impact in your new role.
47
- """
48
-
49
- def process_resume(pdf_path):
50
- text = extract_text_from_pdf(pdf_path)
51
- details = extract_resume_details(text)
52
- email_prompt = generate_cold_email(details)
53
-
54
- output_path = "Cold_Email_Prompt.txt"
55
- with open(output_path, "w") as file:
56
- file.write(email_prompt)
57
-
58
- return output_path
59
-
60
- # Example usage
61
- # pdf_path = "C:\Users\Admin\Downloads\Mandar_Bhalerao_IISc.pdf" # Use the actual path to the PDF file
62
- pdf_path = "C:/Users/Admin/Downloads/Mandar_Bhalerao_IISc.pdf"
63
-
64
- output_path = process_resume(pdf_path)
65
- print(f"Cold email prompt saved at: {output_path}")