Skip to content

Commit a1068d9

Browse files
authored
Merge pull request #990 from Rupesh-Singh-Karki/feat/automated_resume_analyzer
Added a new feature automated_resume_analyzer
2 parents 8e06f69 + f23fa56 commit a1068d9

File tree

3 files changed

+125
-0
lines changed

3 files changed

+125
-0
lines changed

automated_resume_analyzer/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Resume Analyzer
2+
3+
This Python script analyzes resumes (in PDF format) for common issues like structure, keyword optimization, and grammar problems. The tool is designed to help users enhance their resumes by providing insights into missing sections, keyword usage, and grammar issues.
4+
5+
## Features
6+
7+
- **Structure Check**: Ensures that key sections such as Education, Experience, Skills, Certifications, and Achievements are present.
8+
- **Keyword Optimization**: Analyzes the resume text for relevant keywords (customizable) to ensure alignment with job descriptions.
9+
- **Grammar Check**: Identifies potential grammar issues such as sentence fragments and missing punctuation.
10+
11+
## Installation
12+
13+
### Prerequisites
14+
15+
Before running the script, you need to have the following installed:
16+
17+
- Python 3.x
18+
- The required Python libraries:
19+
- `PyPDF2` (for PDF text extraction)
20+
- `nltk` (for text analysis and grammar checks)
21+
22+
You can install the necessary libraries using pip:
23+
24+
```bash
25+
pip install PyPDF2 nltk
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import re
2+
import PyPDF2
3+
import nltk
4+
from nltk.corpus import stopwords
5+
from nltk.tokenize import word_tokenize, sent_tokenize
6+
7+
nltk.download('punkt')
8+
nltk.download('stopwords')
9+
10+
11+
# Function to extract text from a PDF file
12+
def extract_text_from_pdf(pdf_path):
13+
text = ""
14+
with open(pdf_path, 'rb') as file:
15+
reader = PyPDF2.PdfReader(file)
16+
for page_num in range(len(reader.pages)):
17+
page = reader.pages[page_num]
18+
text += page.extract_text()
19+
return text
20+
21+
22+
# Function to analyze the structure of the resume
23+
def check_structure(text):
24+
structure_issues = []
25+
sections = [
26+
'Education',
27+
'Experience',
28+
'Skills',
29+
'Certifications',
30+
'Achievements'
31+
]
32+
for section in sections:
33+
if section.lower() not in text.lower():
34+
structure_issues.append(f"Missing section: {section}")
35+
return structure_issues
36+
37+
38+
# Function to check keyword optimization in the resume
39+
def keyword_optimization(text, keywords):
40+
text_tokens = word_tokenize(text.lower())
41+
keywords_found = [word for word in text_tokens if word in keywords]
42+
return keywords_found
43+
44+
45+
# Function to check for grammar issues
46+
def grammar_check(text):
47+
grammar_issues = []
48+
sentences = sent_tokenize(text)
49+
stop_words = set(stopwords.words('english'))
50+
51+
for sentence in sentences:
52+
words = word_tokenize(sentence)
53+
filtered_sentence = [w for w in words if not w.lower() in stop_words]
54+
# Check basic length and punctuation rules
55+
if len(filtered_sentence) < 3:
56+
grammar_issues.append(f"Possible fragment: {sentence}")
57+
if not re.match(r'.*[.!?]$', sentence.strip()):
58+
grammar_issues.append(f"Missing punctuation: {sentence}")
59+
60+
return grammar_issues
61+
62+
63+
# Main function to run the resume analyzer
64+
def analyze_resume(pdf_path, keywords):
65+
text = extract_text_from_pdf(pdf_path)
66+
67+
print("Analyzing structure...")
68+
structure_issues = check_structure(text)
69+
if structure_issues:
70+
print("Structure Issues Found:")
71+
for issue in structure_issues:
72+
print(f"- {issue}")
73+
else:
74+
print("Structure looks good.")
75+
76+
print("\nAnalyzing keyword optimization...")
77+
found_keywords = keyword_optimization(text, keywords)
78+
print(f"Keywords found: {', '.join(found_keywords)}")
79+
80+
print("\nAnalyzing grammar...")
81+
grammar_issues = grammar_check(text)
82+
if grammar_issues:
83+
print("Grammar Issues Found:")
84+
for issue in grammar_issues:
85+
print(f"- {issue}")
86+
else:
87+
print("No major grammar issues found.")
88+
89+
print("\nAnalysis complete.")
90+
91+
92+
if __name__ == "__main__":
93+
# Keywords to check for in the resume (can be customized)
94+
resume_keywords = ['python', 'machine learning', 'data analysis', 'sql']
95+
96+
# Example usage
97+
resume_path = 'your_resume.pdf' # Replace with the actual file path
98+
analyze_resume(resume_path, resume_keywords)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PyPDF2==3.0.1
2+
nltk==3.8.1

0 commit comments

Comments
 (0)