Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- bert.py +238 -0
- doc2vec.py +277 -0
- main.py +266 -0
- requirements.txt +11 -0
bert.py
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Import necessary libraries
|
2 |
+
import streamlit as st
|
3 |
+
import nltk
|
4 |
+
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
|
5 |
+
from nltk.tokenize import word_tokenize
|
6 |
+
import PyPDF2
|
7 |
+
import pandas as pd
|
8 |
+
import re
|
9 |
+
import matplotlib.pyplot as plt
|
10 |
+
import seaborn as sns
|
11 |
+
import spacy
|
12 |
+
|
13 |
+
# Download necessary NLTK data
|
14 |
+
nltk.download('punkt')
|
15 |
+
|
16 |
+
# Define regular expressions for pattern matching
|
17 |
+
float_regex = re.compile(r'^\d{1,2}(\.\d{1,2})?$')
|
18 |
+
email_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
|
19 |
+
float_digit_regex = re.compile(r'^\d{10}$')
|
20 |
+
email_with_phone_regex = re.compile(r'(\d{10}).|.(\d{10})')
|
21 |
+
|
22 |
+
# Function to extract text from a PDF file
|
23 |
+
def extract_text_from_pdf(pdf_file):
|
24 |
+
pdf_reader = PyPDF2.PdfReader(pdf_file)
|
25 |
+
text = ""
|
26 |
+
for page_num in range(len(pdf_reader.pages)):
|
27 |
+
text += pdf_reader.pages[page_num].extract_text()
|
28 |
+
return text
|
29 |
+
|
30 |
+
# Function to tokenize text using the NLP model
|
31 |
+
def tokenize_text(text, nlp_model):
|
32 |
+
doc = nlp_model(text, disable=["tagger", "parser"])
|
33 |
+
tokens = [(token.text.lower(), token.label_) for token in doc.ents]
|
34 |
+
return tokens
|
35 |
+
|
36 |
+
# Function to extract CGPA from a resume
|
37 |
+
def extract_cgpa(resume_text):
|
38 |
+
cgpa_pattern = r'\b(?:CGPA|GPA|C\.G\.PA|Cumulative GPA)\s*:?[\s-]([0-9]+(?:\.[0-9]+)?)\b|\b([0-9]+(?:\.[0-9]+)?)\s(?:CGPA|GPA)\b'
|
39 |
+
match = re.search(cgpa_pattern, resume_text, re.IGNORECASE)
|
40 |
+
if match:
|
41 |
+
cgpa = match.group(1) if match.group(1) else match.group(2)
|
42 |
+
return float(cgpa)
|
43 |
+
else:
|
44 |
+
return None
|
45 |
+
|
46 |
+
# Function to extract skills from a resume
|
47 |
+
def extract_skills(text, skills_keywords):
|
48 |
+
skills = [skill.lower() for skill in skills_keywords if re.search(r'\b' + re.escape(skill.lower()) + r'\b', text.lower())]
|
49 |
+
return skills
|
50 |
+
|
51 |
+
# Function to preprocess text
|
52 |
+
def preprocess_text(text):
|
53 |
+
return word_tokenize(text.lower())
|
54 |
+
|
55 |
+
# Function to train a Doc2Vec model
|
56 |
+
def train_doc2vec_model(documents):
|
57 |
+
model = Doc2Vec(vector_size=20, min_count=2, epochs=50)
|
58 |
+
model.build_vocab(documents)
|
59 |
+
model.train(documents, total_examples=model.corpus_count, epochs=model.epochs)
|
60 |
+
return model
|
61 |
+
|
62 |
+
# Function to calculate similarity between two texts
|
63 |
+
def calculate_similarity(model, text1, text2):
|
64 |
+
vector1 = model.infer_vector(preprocess_text(text1))
|
65 |
+
vector2 = model.infer_vector(preprocess_text(text2))
|
66 |
+
return model.dv.cosine_similarities(vector1, [vector2])[0]
|
67 |
+
|
68 |
+
# Function to calculate accuracy
|
69 |
+
def accuracy_calculation(true_positives, false_positives, false_negatives):
|
70 |
+
total = true_positives + false_positives + false_negatives
|
71 |
+
accuracy = true_positives / total if total != 0 else 0
|
72 |
+
return accuracy
|
73 |
+
|
74 |
+
# Streamlit Frontend
|
75 |
+
st.markdown("# Resume Matching Tool ππ")
|
76 |
+
st.markdown("An application to match resumes with a job description.")
|
77 |
+
|
78 |
+
# Sidebar - File Upload for Resumes
|
79 |
+
st.sidebar.markdown("## Upload Resumes PDF")
|
80 |
+
resumes_files = st.sidebar.file_uploader("Upload Resumes PDF", type=["pdf"], accept_multiple_files=True)
|
81 |
+
|
82 |
+
if resumes_files:
|
83 |
+
# Sidebar - File Upload for Job Descriptions
|
84 |
+
st.sidebar.markdown("## Upload Job Description PDF")
|
85 |
+
job_descriptions_file = st.sidebar.file_uploader("Upload Job Description PDF", type=["pdf"])
|
86 |
+
|
87 |
+
if job_descriptions_file:
|
88 |
+
# Load the pre-trained NLP model
|
89 |
+
nlp_model_path = "en_Resume_Matching_Keywords"
|
90 |
+
nlp = spacy.load(nlp_model_path)
|
91 |
+
|
92 |
+
# Backend Processing
|
93 |
+
job_description_text = extract_text_from_pdf(job_descriptions_file)
|
94 |
+
resumes_texts = [extract_text_from_pdf(resume_file) for resume_file in resumes_files]
|
95 |
+
job_description_text = extract_text_from_pdf(job_descriptions_file)
|
96 |
+
job_description_tokens = tokenize_text(job_description_text, nlp)
|
97 |
+
|
98 |
+
# Initialize counters
|
99 |
+
overall_skill_matches = 0
|
100 |
+
overall_qualification_matches = 0
|
101 |
+
|
102 |
+
# Create a list to store individual results
|
103 |
+
results_list = []
|
104 |
+
job_skills = set()
|
105 |
+
job_qualifications = set()
|
106 |
+
|
107 |
+
for job_token, job_label in job_description_tokens:
|
108 |
+
if job_label == 'QUALIFICATION':
|
109 |
+
job_qualifications.add(job_token.replace('\n', ' '))
|
110 |
+
elif job_label == 'SKILLS':
|
111 |
+
job_skills.add(job_token.replace('\n', ' '))
|
112 |
+
|
113 |
+
job_skills_number = len(job_skills)
|
114 |
+
job_qualifications_number = len(job_qualifications)
|
115 |
+
|
116 |
+
# Lists to store counts of matched skills for all resumes
|
117 |
+
skills_counts_all_resumes = []
|
118 |
+
|
119 |
+
# Iterate over all uploaded resumes
|
120 |
+
for uploaded_resume in resumes_files:
|
121 |
+
resume_text = extract_text_from_pdf(uploaded_resume)
|
122 |
+
resume_tokens = tokenize_text(resume_text, nlp)
|
123 |
+
|
124 |
+
# Initialize counters for individual resume
|
125 |
+
skillMatch = 0
|
126 |
+
qualificationMatch = 0
|
127 |
+
cgpa = ""
|
128 |
+
|
129 |
+
# Lists to store matched skills and qualifications for each resume
|
130 |
+
matched_skills = set()
|
131 |
+
matched_qualifications = set()
|
132 |
+
email = set()
|
133 |
+
phone = set()
|
134 |
+
name = set()
|
135 |
+
|
136 |
+
# Compare the tokens in the resume with the job description
|
137 |
+
for resume_token, resume_label in resume_tokens:
|
138 |
+
for job_token, job_label in job_description_tokens:
|
139 |
+
if resume_token.lower().replace('\n', ' ') == job_token.lower().replace('\n', ' '):
|
140 |
+
if resume_label == 'SKILLS':
|
141 |
+
matched_skills.add(resume_token.replace('\n', ' '))
|
142 |
+
elif resume_label == 'QUALIFICATION':
|
143 |
+
matched_qualifications.add(resume_token.replace('\n', ' '))
|
144 |
+
elif resume_label == 'PHONE' and bool(float_digit_regex.match(resume_token)):
|
145 |
+
phone.add(resume_token)
|
146 |
+
elif resume_label == 'QUALIFICATION':
|
147 |
+
matched_qualifications.add(resume_token.replace('\n', ' '))
|
148 |
+
|
149 |
+
skillMatch = len(matched_skills)
|
150 |
+
qualificationMatch = len(matched_qualifications)
|
151 |
+
|
152 |
+
# Convert the list of emails to a set
|
153 |
+
email_set = set(re.findall(email_pattern, resume_text.replace('\n', ' ')))
|
154 |
+
email.update(email_set)
|
155 |
+
|
156 |
+
numberphone=""
|
157 |
+
for email_str in email:
|
158 |
+
numberphone = email_with_phone_regex.search(email_str)
|
159 |
+
if numberphone:
|
160 |
+
email.remove(email_str)
|
161 |
+
val=numberphone.group(1) or numberphone.group(2)
|
162 |
+
phone.add(val)
|
163 |
+
email.add(email_str.strip(val))
|
164 |
+
|
165 |
+
# Increment overall counters based on matches
|
166 |
+
overall_skill_matches += skillMatch
|
167 |
+
overall_qualification_matches += qualificationMatch
|
168 |
+
|
169 |
+
# Add count of matched skills for this resume to the list
|
170 |
+
skills_counts_all_resumes.append([resume_text.count(skill.lower()) for skill in job_skills])
|
171 |
+
|
172 |
+
# Create a dictionary for the current resume and append to the results list
|
173 |
+
result_dict = {
|
174 |
+
"Resume": uploaded_resume.name,
|
175 |
+
"Similarity Score": (skillMatch/job_skills_number)*100,
|
176 |
+
"Skill Matches": skillMatch,
|
177 |
+
"Matched Skills": matched_skills,
|
178 |
+
"CGPA": extract_cgpa(resume_text),
|
179 |
+
"Email": email,
|
180 |
+
"Phone": phone,
|
181 |
+
"Qualification Matches": qualificationMatch,
|
182 |
+
"Matched Qualifications": matched_qualifications
|
183 |
+
}
|
184 |
+
|
185 |
+
results_list.append(result_dict)
|
186 |
+
|
187 |
+
# Display overall matches
|
188 |
+
st.subheader("Overall Matches")
|
189 |
+
st.write(f"Total Skill Matches: {overall_skill_matches}")
|
190 |
+
st.write(f"Total Qualification Matches: {overall_qualification_matches}")
|
191 |
+
st.write(f"Job Qualifications: {job_qualifications}")
|
192 |
+
st.write(f"Job Skills: {job_skills}")
|
193 |
+
|
194 |
+
# Display individual results in a table
|
195 |
+
results_df = pd.DataFrame(results_list)
|
196 |
+
st.subheader("Individual Results")
|
197 |
+
st.dataframe(results_df)
|
198 |
+
tagged_resumes = [TaggedDocument(words=preprocess_text(text), tags=[str(i)]) for i, text in enumerate(resumes_texts)]
|
199 |
+
model_resumes = train_doc2vec_model(tagged_resumes)
|
200 |
+
|
201 |
+
st.subheader("\nHeatmap:")
|
202 |
+
|
203 |
+
# Get skills keywords from user input
|
204 |
+
skills_keywords_input = st.text_input("Enter skills keywords separated by commas (e.g., python, java, machine learning):")
|
205 |
+
skills_keywords = [skill.strip() for skill in skills_keywords_input.split(',') if skill.strip()]
|
206 |
+
|
207 |
+
if skills_keywords:
|
208 |
+
# Calculate the similarity score between each skill keyword and the resume text
|
209 |
+
skills_similarity_scores = []
|
210 |
+
for resume_text in resumes_texts:
|
211 |
+
resume_text_similarity_scores = []
|
212 |
+
for skill in skills_keywords:
|
213 |
+
similarity_score = calculate_similarity(model_resumes, resume_text, skill)
|
214 |
+
resume_text_similarity_scores.append(similarity_score)
|
215 |
+
skills_similarity_scores.append(resume_text_similarity_scores)
|
216 |
+
|
217 |
+
# Create a DataFrame with the similarity scores and set the index to the names of the PDFs
|
218 |
+
skills_similarity_df = pd.DataFrame(skills_similarity_scores, columns=skills_keywords, index=[resume_file.name for resume_file in resumes_files])
|
219 |
+
|
220 |
+
# Plot the heatmap
|
221 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
222 |
+
sns.heatmap(skills_similarity_df, cmap='YlGnBu', annot=True, fmt=".2f", ax=ax)
|
223 |
+
ax.set_title('Heatmap for Skills Similarity')
|
224 |
+
ax.set_xlabel('Skills')
|
225 |
+
ax.set_ylabel('Resumes')
|
226 |
+
|
227 |
+
# Rotate the y-axis labels for better readability
|
228 |
+
plt.yticks(rotation=0)
|
229 |
+
|
230 |
+
# Display the Matplotlib figure using st.pyplot()
|
231 |
+
st.pyplot(fig)
|
232 |
+
else:
|
233 |
+
st.write("Please enter at least one skill keyword.")
|
234 |
+
|
235 |
+
else:
|
236 |
+
st.warning("Please upload the Job Description PDF to proceed.")
|
237 |
+
else:
|
238 |
+
st.warning("Please upload Resumes PDF to proceed.")
|
doc2vec.py
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Importing necessary libraries
|
2 |
+
from collections import Counter
|
3 |
+
import streamlit as st
|
4 |
+
import nltk
|
5 |
+
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
|
6 |
+
from nltk.tokenize import word_tokenize
|
7 |
+
import PyPDF2
|
8 |
+
import pandas as pd
|
9 |
+
import re
|
10 |
+
import matplotlib.pyplot as plt
|
11 |
+
import seaborn as sns
|
12 |
+
|
13 |
+
# Downloading the 'punkt' tokenizer from NLTK
|
14 |
+
nltk.download('punkt')
|
15 |
+
|
16 |
+
# Function to extract text from a PDF file
|
17 |
+
def extract_text_from_pdf(pdf_file):
|
18 |
+
pdf_reader = PyPDF2.PdfReader(pdf_file)
|
19 |
+
text = ""
|
20 |
+
for page_num in range(len(pdf_reader.pages)):
|
21 |
+
text += pdf_reader.pages[page_num].extract_text()
|
22 |
+
return text
|
23 |
+
|
24 |
+
# Function to extract skills from a text using a list of skill keywords
|
25 |
+
def extract_skills(text, skills_keywords):
|
26 |
+
skills = [skill.lower()
|
27 |
+
for skill in skills_keywords if re.search(r'\b' + re.escape(skill.lower()) + r'\b', text.lower())]
|
28 |
+
return skills
|
29 |
+
|
30 |
+
# Function to preprocess text by tokenizing and converting to lowercase
|
31 |
+
def preprocess_text(text):
|
32 |
+
return word_tokenize(text.lower())
|
33 |
+
|
34 |
+
# Function to extract mobile numbers from a text
|
35 |
+
def extract_mobile_numbers(text):
|
36 |
+
mobile_pattern = r'\b\d{10}\b|\b\d{3}[-.\s]?\d{3}[-.\s]?\d{4}\b'
|
37 |
+
return re.findall(mobile_pattern, text)
|
38 |
+
|
39 |
+
# Function to extract emails from a text
|
40 |
+
def extract_emails(text):
|
41 |
+
email_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
|
42 |
+
return re.findall(email_pattern, text)
|
43 |
+
|
44 |
+
# Function to train a Doc2Vec model on a list of tagged documents
|
45 |
+
def train_doc2vec_model(documents):
|
46 |
+
model = Doc2Vec(vector_size=20, min_count=2, epochs=50)
|
47 |
+
model.build_vocab(documents)
|
48 |
+
model.train(documents, total_examples=model.corpus_count,
|
49 |
+
epochs=model.epochs)
|
50 |
+
return model
|
51 |
+
|
52 |
+
# Function to calculate the cosine similarity between two texts using a trained Doc2Vec model
|
53 |
+
def calculate_similarity(model, text1, text2):
|
54 |
+
vector1 = model.infer_vector(preprocess_text(text1))
|
55 |
+
vector2 = model.infer_vector(preprocess_text(text2))
|
56 |
+
return model.dv.cosine_similarities(vector1, [vector2])[0]
|
57 |
+
|
58 |
+
# Function to calculate accuracy based on true positives, false positives, and false negatives
|
59 |
+
def accuracy_calculation(true_positives, false_positives, false_negatives):
|
60 |
+
total = true_positives + false_positives + false_negatives
|
61 |
+
accuracy = true_positives / total if total != 0 else 0
|
62 |
+
return accuracy
|
63 |
+
|
64 |
+
# Function to extract CGPA from a text
|
65 |
+
def extract_cgpa(resume_text):
|
66 |
+
# Define a regular expression pattern for CGPA extraction
|
67 |
+
cgpa_pattern = r'\b(?:CGPA|GPA|C.G.PA|Cumulative GPA)\s*:?[\s-]* ([0-9]+(?:\.[0-9]+)?)\b|\b([0-9]+(?:\.[0-9]+)?)\s*(?:CGPA|GPA)\b'
|
68 |
+
|
69 |
+
# Search for CGPA pattern in the text
|
70 |
+
match = re.search(cgpa_pattern, resume_text, re.IGNORECASE)
|
71 |
+
|
72 |
+
# Check if a match is found
|
73 |
+
if match:
|
74 |
+
cgpa = match.group(1)
|
75 |
+
if cgpa is not None:
|
76 |
+
return float(cgpa)
|
77 |
+
else:
|
78 |
+
return float(match.group(2))
|
79 |
+
else:
|
80 |
+
return None
|
81 |
+
|
82 |
+
# Regular expressions for email and phone number patterns
|
83 |
+
email_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
|
84 |
+
phone_pattern = r'\b\d{10}\b|\b\d{3}[-.\s]?\d{3}[-.\s]?\d{4}\b'
|
85 |
+
|
86 |
+
# Streamlit Frontend
|
87 |
+
st.markdown("# Resume Matching Tool ππ")
|
88 |
+
st.markdown("An application to match resumes with a job description.")
|
89 |
+
|
90 |
+
# Sidebar - File Upload for Resumes
|
91 |
+
st.sidebar.markdown("## Upload Resumes PDF")
|
92 |
+
resumes_files = st.sidebar.file_uploader(
|
93 |
+
"Upload Resumes PDF", type=["pdf"], accept_multiple_files=True)
|
94 |
+
|
95 |
+
if resumes_files:
|
96 |
+
# Sidebar - File Upload for Job Descriptions
|
97 |
+
st.sidebar.markdown("## Upload Job Description PDF")
|
98 |
+
job_descriptions_file = st.sidebar.file_uploader(
|
99 |
+
"Upload Job Description PDF", type=["pdf"])
|
100 |
+
|
101 |
+
if job_descriptions_file:
|
102 |
+
# Sidebar - Sorting Options
|
103 |
+
sort_options = ['Weighted Score', 'Similarity Score']
|
104 |
+
selected_sort_option = st.sidebar.selectbox(
|
105 |
+
"Sort results by", sort_options)
|
106 |
+
|
107 |
+
# Backend Processing
|
108 |
+
job_description_text = extract_text_from_pdf(job_descriptions_file)
|
109 |
+
resumes_texts = [extract_text_from_pdf(
|
110 |
+
resume_file) for resume_file in resumes_files]
|
111 |
+
|
112 |
+
tagged_resumes = [TaggedDocument(words=preprocess_text(
|
113 |
+
text), tags=[str(i)]) for i, text in enumerate(resumes_texts)]
|
114 |
+
model_resumes = train_doc2vec_model(tagged_resumes)
|
115 |
+
|
116 |
+
true_positives_mobile = 0
|
117 |
+
false_positives_mobile = 0
|
118 |
+
false_negatives_mobile = 0
|
119 |
+
|
120 |
+
true_positives_email = 0
|
121 |
+
false_positives_email = 0
|
122 |
+
false_negatives_email = 0
|
123 |
+
|
124 |
+
results_data = {'Resume': [], 'Similarity Score': [],
|
125 |
+
'Weighted Score': [], 'Email': [], 'Contact': [], 'CGPA': []}
|
126 |
+
|
127 |
+
for i, resume_text in enumerate(resumes_texts):
|
128 |
+
extracted_mobile_numbers = set(extract_mobile_numbers(resume_text))
|
129 |
+
extracted_emails = set(extract_emails(resume_text))
|
130 |
+
extracted_cgpa = extract_cgpa(resume_text)
|
131 |
+
|
132 |
+
ground_truth_mobile_numbers = {'1234567890', '9876543210'}
|
133 |
+
ground_truth_emails = {
|
134 |
+
'[email protected]', '[email protected]'}
|
135 |
+
|
136 |
+
true_positives_mobile += len(
|
137 |
+
extracted_mobile_numbers.intersection(ground_truth_mobile_numbers))
|
138 |
+
false_positives_mobile += len(
|
139 |
+
extracted_mobile_numbers.difference(ground_truth_mobile_numbers))
|
140 |
+
false_negatives_mobile += len(
|
141 |
+
ground_truth_mobile_numbers.difference(extracted_mobile_numbers))
|
142 |
+
|
143 |
+
true_positives_email += len(
|
144 |
+
extracted_emails.intersection(ground_truth_emails))
|
145 |
+
false_positives_email += len(
|
146 |
+
extracted_emails.difference(ground_truth_emails))
|
147 |
+
false_negatives_email += len(
|
148 |
+
ground_truth_emails.difference(extracted_emails))
|
149 |
+
|
150 |
+
similarity_score = calculate_similarity(
|
151 |
+
model_resumes, resume_text, job_description_text)
|
152 |
+
|
153 |
+
other_criteria_score = 0
|
154 |
+
|
155 |
+
weighted_score = (0.6 * similarity_score) + \
|
156 |
+
(0.4 * other_criteria_score)
|
157 |
+
|
158 |
+
results_data['Resume'].append(resumes_files[i].name)
|
159 |
+
results_data['Similarity Score'].append(similarity_score * 100)
|
160 |
+
results_data['Weighted Score'].append(weighted_score)
|
161 |
+
|
162 |
+
emails = ', '.join(re.findall(email_pattern, resume_text))
|
163 |
+
contacts = ', '.join(re.findall(phone_pattern, resume_text))
|
164 |
+
results_data['Email'].append(emails)
|
165 |
+
results_data['Contact'].append(contacts)
|
166 |
+
results_data['CGPA'].append(extracted_cgpa)
|
167 |
+
|
168 |
+
results_df = pd.DataFrame(results_data)
|
169 |
+
|
170 |
+
if selected_sort_option == 'Similarity Score':
|
171 |
+
results_df = results_df.sort_values(
|
172 |
+
by='Similarity Score', ascending=False)
|
173 |
+
else:
|
174 |
+
results_df = results_df.sort_values(
|
175 |
+
by='Weighted Score', ascending=False)
|
176 |
+
|
177 |
+
st.subheader(f"Results Table (Sorted by {selected_sort_option}):")
|
178 |
+
|
179 |
+
# Define a custom function to highlight maximum values in the specified columns
|
180 |
+
def highlight_max(data, color='grey'):
|
181 |
+
is_max = data == data.max()
|
182 |
+
return [f'background-color: {color}' if val else '' for val in is_max]
|
183 |
+
|
184 |
+
# Apply the custom highlighting function to the DataFrame
|
185 |
+
st.dataframe(results_df.style.apply(highlight_max, subset=[
|
186 |
+
'Similarity Score', 'Weighted Score', 'CGPA']))
|
187 |
+
|
188 |
+
|
189 |
+
highest_score_index = results_df['Similarity Score'].idxmax()
|
190 |
+
highest_score_resume_name = resumes_files[highest_score_index].name
|
191 |
+
|
192 |
+
st.subheader("\nDetails of Highest Similarity Score Resume:")
|
193 |
+
st.write(f"Resume Name: {highest_score_resume_name}")
|
194 |
+
st.write(
|
195 |
+
f"Similarity Score: {results_df.loc[highest_score_index, 'Similarity Score']:.2f}")
|
196 |
+
|
197 |
+
if 'Weighted Score' in results_df.columns:
|
198 |
+
weighted_score_value = results_df.loc[highest_score_index,
|
199 |
+
'Weighted Score']
|
200 |
+
st.write(f"Weighted Score: {weighted_score_value:.2f}" if pd.notnull(
|
201 |
+
weighted_score_value) else "Weighted Score: Not Mentioned")
|
202 |
+
else:
|
203 |
+
st.write("Weighted Score: Not Mentioned")
|
204 |
+
|
205 |
+
if 'Email' in results_df.columns:
|
206 |
+
email_value = results_df.loc[highest_score_index, 'Email']
|
207 |
+
st.write(f"Email: {email_value}" if pd.notnull(
|
208 |
+
email_value) else "Email: Not Mentioned")
|
209 |
+
else:
|
210 |
+
st.write("Email: Not Mentioned")
|
211 |
+
|
212 |
+
if 'Contact' in results_df.columns:
|
213 |
+
contact_value = results_df.loc[highest_score_index, 'Contact']
|
214 |
+
st.write(f"Contact: {contact_value}" if pd.notnull(
|
215 |
+
contact_value) else "Contact: Not Mentioned")
|
216 |
+
else:
|
217 |
+
st.write("Contact: Not Mentioned")
|
218 |
+
|
219 |
+
if 'CGPA' in results_df.columns:
|
220 |
+
cgpa_value = results_df.loc[highest_score_index, 'CGPA']
|
221 |
+
st.write(f"CGPA: {cgpa_value}" if pd.notnull(
|
222 |
+
cgpa_value) else "CGPA: Not Mentioned")
|
223 |
+
else:
|
224 |
+
st.write("CGPA: Not Mentioned")
|
225 |
+
|
226 |
+
mobile_accuracy = accuracy_calculation(
|
227 |
+
true_positives_mobile, false_positives_mobile, false_negatives_mobile)
|
228 |
+
email_accuracy = accuracy_calculation(
|
229 |
+
true_positives_email, false_positives_email, false_negatives_email)
|
230 |
+
|
231 |
+
st.subheader("\nHeatmap:")
|
232 |
+
# st.write(f"Mobile Number Accuracy: {mobile_accuracy:.2%}")
|
233 |
+
# st.write(f"Email Accuracy: {email_accuracy:.2%}")
|
234 |
+
|
235 |
+
# Get skills keywords from user input
|
236 |
+
skills_keywords_input = st.text_input(
|
237 |
+
"Enter skills keywords separated by commas (e.g., python, java, machine learning):")
|
238 |
+
skills_keywords = [skill.strip()
|
239 |
+
for skill in skills_keywords_input.split(',') if skill.strip()]
|
240 |
+
|
241 |
+
if skills_keywords:
|
242 |
+
# Calculate the similarity score between each skill keyword and the resume text
|
243 |
+
skills_similarity_scores = []
|
244 |
+
for resume_text in resumes_texts:
|
245 |
+
resume_text_similarity_scores = []
|
246 |
+
for skill in skills_keywords:
|
247 |
+
similarity_score = calculate_similarity(
|
248 |
+
model_resumes, resume_text, skill)
|
249 |
+
resume_text_similarity_scores.append(similarity_score)
|
250 |
+
skills_similarity_scores.append(resume_text_similarity_scores)
|
251 |
+
|
252 |
+
# Create a DataFrame with the similarity scores and set the index to the names of the PDFs
|
253 |
+
skills_similarity_df = pd.DataFrame(
|
254 |
+
skills_similarity_scores, columns=skills_keywords, index=[resume_file.name for resume_file in resumes_files])
|
255 |
+
|
256 |
+
# Plot the heatmap
|
257 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
258 |
+
|
259 |
+
sns.heatmap(skills_similarity_df,
|
260 |
+
cmap='YlGnBu', annot=True, fmt=".2f", ax=ax)
|
261 |
+
ax.set_title('Heatmap for Skills Similarity')
|
262 |
+
ax.set_xlabel('Skills')
|
263 |
+
ax.set_ylabel('Resumes')
|
264 |
+
|
265 |
+
# Rotate the y-axis labels for better readability
|
266 |
+
plt.yticks(rotation=0)
|
267 |
+
|
268 |
+
# Display the Matplotlib figure using st.pyplot()
|
269 |
+
st.pyplot(fig)
|
270 |
+
else:
|
271 |
+
st.write("Please enter at least one skill keyword.")
|
272 |
+
|
273 |
+
|
274 |
+
else:
|
275 |
+
st.warning("Please upload the Job Description PDF to proceed.")
|
276 |
+
else:
|
277 |
+
st.warning("Please upload Resumes PDF to proceed.")
|
main.py
ADDED
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from collections import Counter
|
2 |
+
import streamlit as st
|
3 |
+
import nltk
|
4 |
+
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
|
5 |
+
from nltk.tokenize import word_tokenize
|
6 |
+
import os
|
7 |
+
import PyPDF2
|
8 |
+
import pandas as pd
|
9 |
+
import re
|
10 |
+
import matplotlib.pyplot as plt
|
11 |
+
import seaborn as sns
|
12 |
+
import spacy
|
13 |
+
from PyPDF2 import PdfReader
|
14 |
+
from io import BytesIO
|
15 |
+
import re
|
16 |
+
import pandas as pd
|
17 |
+
import matplotlib.pyplot as plt
|
18 |
+
import seaborn as sns
|
19 |
+
|
20 |
+
nltk.download('punkt')
|
21 |
+
|
22 |
+
|
23 |
+
nlp_model_path = "en_Resume_Matching_Keywords"
|
24 |
+
nlp = spacy.load(nlp_model_path)
|
25 |
+
|
26 |
+
float_regex = re.compile(r'^\d{1,2}(\.\d{1,2})?$')
|
27 |
+
email_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
|
28 |
+
float_digit_regex = re.compile(r'^\d+$')
|
29 |
+
email_with_phone_regex = email_with_phone_regex = re.compile(
|
30 |
+
r'(\d{10}).|.(\d{10})')
|
31 |
+
|
32 |
+
|
33 |
+
def extract_text_from_pdf(pdf_file):
|
34 |
+
pdf_reader = PyPDF2.PdfReader(pdf_file)
|
35 |
+
text = ""
|
36 |
+
for page_num in range(len(pdf_reader.pages)):
|
37 |
+
text += pdf_reader.pages[page_num].extract_text()
|
38 |
+
return text
|
39 |
+
|
40 |
+
|
41 |
+
def tokenize_text(text, nlp_model):
|
42 |
+
doc = nlp_model(text, disable=["tagger", "parser"])
|
43 |
+
tokens = [(token.text.lower(), token.label_) for token in doc.ents]
|
44 |
+
return tokens
|
45 |
+
|
46 |
+
|
47 |
+
def extract_cgpa(resume_text):
|
48 |
+
# Define a regular expression pattern for CGPA extraction
|
49 |
+
cgpa_pattern = r'\b(?:CGPA|GPA|C\.G\.PA|Cumulative GPA)\s*:?[\s-]([0-9]+(?:\.[0-9]+)?)\b|\b([0-9]+(?:\.[0-9]+)?)\s(?:CGPA|GPA)\b'
|
50 |
+
|
51 |
+
# Search for CGPA pattern in the text
|
52 |
+
match = re.search(cgpa_pattern, resume_text, re.IGNORECASE)
|
53 |
+
|
54 |
+
# Check if a match is found
|
55 |
+
if match:
|
56 |
+
# Extract CGPA value
|
57 |
+
cgpa = match.group(1) if match.group(1) else match.group(2)
|
58 |
+
return float(cgpa)
|
59 |
+
else:
|
60 |
+
return None
|
61 |
+
|
62 |
+
|
63 |
+
def extract_skills(text, skills_keywords):
|
64 |
+
skills = [skill.lower()
|
65 |
+
for skill in skills_keywords if re.search(r'\b' + re.escape(skill.lower()) + r'\b', text.lower())]
|
66 |
+
return skills
|
67 |
+
|
68 |
+
|
69 |
+
def preprocess_text(text):
|
70 |
+
return word_tokenize(text.lower())
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
def train_doc2vec_model(documents):
|
77 |
+
model = Doc2Vec(vector_size=20, min_count=2, epochs=50)
|
78 |
+
model.build_vocab(documents)
|
79 |
+
model.train(documents, total_examples=model.corpus_count,
|
80 |
+
epochs=model.epochs)
|
81 |
+
return model
|
82 |
+
|
83 |
+
|
84 |
+
def calculate_similarity(model, text1, text2):
|
85 |
+
vector1 = model.infer_vector(preprocess_text(text1))
|
86 |
+
vector2 = model.infer_vector(preprocess_text(text2))
|
87 |
+
return model.dv.cosine_similarities(vector1, [vector2])[0]
|
88 |
+
|
89 |
+
|
90 |
+
def accuracy_calculation(true_positives, false_positives, false_negatives):
|
91 |
+
total = true_positives + false_positives + false_negatives
|
92 |
+
accuracy = true_positives / total if total != 0 else 0
|
93 |
+
return accuracy
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
# Streamlit Frontend
|
101 |
+
st.markdown("# Resume Matching Tool ππ")
|
102 |
+
st.markdown("An application to match resumes with a job description.")
|
103 |
+
|
104 |
+
# Sidebar - File Upload for Resumes
|
105 |
+
st.sidebar.markdown("## Upload Resumes PDF")
|
106 |
+
resumes_files = st.sidebar.file_uploader(
|
107 |
+
"Upload Resumes PDF", type=["pdf"], accept_multiple_files=True)
|
108 |
+
|
109 |
+
if resumes_files:
|
110 |
+
# Sidebar - File Upload for Job Descriptions
|
111 |
+
st.sidebar.markdown("## Upload Job Description PDF")
|
112 |
+
job_descriptions_file = st.sidebar.file_uploader(
|
113 |
+
"Upload Job Description PDF", type=["pdf"])
|
114 |
+
|
115 |
+
if job_descriptions_file:
|
116 |
+
|
117 |
+
# Backend Processing
|
118 |
+
job_description_text = extract_text_from_pdf(job_descriptions_file)
|
119 |
+
resumes_texts = [extract_text_from_pdf(
|
120 |
+
resume_file) for resume_file in resumes_files]
|
121 |
+
job_description_text = extract_text_from_pdf(job_descriptions_file)
|
122 |
+
job_description_tokens = tokenize_text(job_description_text, nlp)
|
123 |
+
|
124 |
+
# st.subheader("Matching Keywords")
|
125 |
+
|
126 |
+
# Initialize counters
|
127 |
+
overall_skill_matches = 0
|
128 |
+
overall_qualification_matches = 0
|
129 |
+
|
130 |
+
# Create a list to store individual results
|
131 |
+
results_list = []
|
132 |
+
job_skills = set()
|
133 |
+
job_qualifications = set()
|
134 |
+
|
135 |
+
for job_token, job_label in job_description_tokens:
|
136 |
+
if job_label == 'QUALIFICATION':
|
137 |
+
job_qualifications.add(job_token)
|
138 |
+
elif job_label == 'SKILLS':
|
139 |
+
job_skills.add(job_token)
|
140 |
+
|
141 |
+
job_skills_number = len(job_skills)
|
142 |
+
job_qualifications_number = len(job_qualifications)
|
143 |
+
|
144 |
+
# Lists to store counts of matched skills for all resumes
|
145 |
+
skills_counts_all_resumes = []
|
146 |
+
|
147 |
+
# Iterate over all uploaded resumes
|
148 |
+
for uploaded_resume in resumes_files:
|
149 |
+
resume_text = extract_text_from_pdf(uploaded_resume)
|
150 |
+
resume_tokens = tokenize_text(resume_text, nlp)
|
151 |
+
|
152 |
+
# Initialize counters for individual resume
|
153 |
+
skillMatch = 0
|
154 |
+
qualificationMatch = 0
|
155 |
+
cgpa = ""
|
156 |
+
|
157 |
+
# Lists to store matched skills and qualifications for each resume
|
158 |
+
matched_skills = set()
|
159 |
+
matched_qualifications = set()
|
160 |
+
email = set()
|
161 |
+
phone = set()
|
162 |
+
name = set()
|
163 |
+
|
164 |
+
# Compare the tokens in the resume with the job description
|
165 |
+
for resume_token, resume_label in resume_tokens:
|
166 |
+
for job_token, job_label in job_description_tokens:
|
167 |
+
if resume_token.lower() == job_token.lower():
|
168 |
+
if resume_label == 'SKILLS':
|
169 |
+
matched_skills.add(resume_token)
|
170 |
+
elif resume_label == 'QUALIFICATION':
|
171 |
+
matched_qualifications.add(resume_token)
|
172 |
+
elif resume_label == 'CGPA' and bool(float_regex.match(resume_token)):
|
173 |
+
cgpa = resume_token
|
174 |
+
elif resume_label == 'PHONE' and bool(float_digit_regex.match(resume_token)):
|
175 |
+
phone.add(resume_token)
|
176 |
+
elif resume_label == 'QUALIFICATION':
|
177 |
+
matched_qualifications.add(resume_token)
|
178 |
+
|
179 |
+
skillMatch = len(matched_skills)
|
180 |
+
qualificationMatch = len(matched_qualifications)
|
181 |
+
|
182 |
+
# Increment overall counters based on matches
|
183 |
+
overall_skill_matches += skillMatch
|
184 |
+
overall_qualification_matches += qualificationMatch
|
185 |
+
|
186 |
+
# Add count of matched skills for this resume to the list
|
187 |
+
skills_counts_all_resumes.append(
|
188 |
+
[resume_text.count(skill.lower()) for skill in job_skills])
|
189 |
+
|
190 |
+
# Create a dictionary for the current resume and append to the results list
|
191 |
+
result_dict = {
|
192 |
+
"Resume": uploaded_resume.name,
|
193 |
+
"Similarity Score": (skillMatch/job_skills_number)*100,
|
194 |
+
"Skill Matches": skillMatch,
|
195 |
+
"Matched Skills": matched_skills,
|
196 |
+
"CGPA": extract_cgpa(resume_text),
|
197 |
+
"Email": email,
|
198 |
+
"Phone": phone,
|
199 |
+
"Qualification Matches": qualificationMatch,
|
200 |
+
"Matched Qualifications": matched_qualifications
|
201 |
+
}
|
202 |
+
|
203 |
+
results_list.append(result_dict)
|
204 |
+
|
205 |
+
# Display overall matches
|
206 |
+
st.subheader("Overall Matches")
|
207 |
+
st.write(f"Total Skill Matches: {overall_skill_matches}")
|
208 |
+
st.write(
|
209 |
+
f"Total Qualification Matches: {overall_qualification_matches}")
|
210 |
+
st.write(f"Job Qualifications: {job_qualifications}")
|
211 |
+
st.write(f"Job Skills: {job_skills}")
|
212 |
+
|
213 |
+
# Display individual results in a table
|
214 |
+
results_df = pd.DataFrame(results_list)
|
215 |
+
st.subheader("Individual Results")
|
216 |
+
st.dataframe(results_df)
|
217 |
+
tagged_resumes = [TaggedDocument(words=preprocess_text(
|
218 |
+
text), tags=[str(i)]) for i, text in enumerate(resumes_texts)]
|
219 |
+
model_resumes = train_doc2vec_model(tagged_resumes)
|
220 |
+
|
221 |
+
|
222 |
+
|
223 |
+
st.subheader("\nHeatmap:")
|
224 |
+
|
225 |
+
# Get skills keywords from user input
|
226 |
+
skills_keywords_input = st.text_input(
|
227 |
+
"Enter skills keywords separated by commas (e.g., python, java, machine learning):")
|
228 |
+
skills_keywords = [skill.strip()
|
229 |
+
for skill in skills_keywords_input.split(',') if skill.strip()]
|
230 |
+
|
231 |
+
if skills_keywords:
|
232 |
+
# Calculate the similarity score between each skill keyword and the resume text
|
233 |
+
skills_similarity_scores = []
|
234 |
+
for resume_text in resumes_texts:
|
235 |
+
resume_text_similarity_scores = []
|
236 |
+
for skill in skills_keywords:
|
237 |
+
similarity_score = calculate_similarity(
|
238 |
+
model_resumes, resume_text, skill)
|
239 |
+
resume_text_similarity_scores.append(similarity_score)
|
240 |
+
skills_similarity_scores.append(resume_text_similarity_scores)
|
241 |
+
|
242 |
+
# Create a DataFrame with the similarity scores and set the index to the names of the PDFs
|
243 |
+
skills_similarity_df = pd.DataFrame(
|
244 |
+
skills_similarity_scores, columns=skills_keywords, index=[resume_file.name for resume_file in resumes_files])
|
245 |
+
|
246 |
+
# Plot the heatmap
|
247 |
+
fig, ax = plt.subplots(figsize=(12, 8))
|
248 |
+
|
249 |
+
sns.heatmap(skills_similarity_df,
|
250 |
+
cmap='YlGnBu', annot=True, fmt=".2f", ax=ax)
|
251 |
+
ax.set_title('Heatmap for Skills Similarity')
|
252 |
+
ax.set_xlabel('Skills')
|
253 |
+
ax.set_ylabel('Resumes')
|
254 |
+
|
255 |
+
# Rotate the y-axis labels for better readability
|
256 |
+
plt.yticks(rotation=0)
|
257 |
+
|
258 |
+
# Display the Matplotlib figure using st.pyplot()
|
259 |
+
st.pyplot(fig)
|
260 |
+
else:
|
261 |
+
st.write("Please enter at least one skill keyword.")
|
262 |
+
|
263 |
+
else:
|
264 |
+
st.warning("Please upload the Job Description PDF to proceed.")
|
265 |
+
else:
|
266 |
+
st.warning("Please upload Resumes PDF to proceed.")
|
requirements.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gensim==4.3.2
|
2 |
+
matplotlib==3.8.2
|
3 |
+
nltk==3.8.1
|
4 |
+
pandas==1.3.5
|
5 |
+
PyPDF2==3.0.1
|
6 |
+
seaborn==0.13.2
|
7 |
+
streamlit==1.31.0
|
8 |
+
torch==2.2.0
|
9 |
+
transformers==4.37.2
|
10 |
+
spacy
|
11 |
+
https://huggingface.co/Priyanka-Balivada/en_Resume_Matching_Keywords/resolve/main/en_Resume_Matching_Keywords-any-py3-none-any.whl
|