We made a program for simple Resume that extract the whole Resume Info in string line by line. Now I want to extract the GPA from that string. I tried a lot but could not get any idea regard this. So if anyone could configure this will be very helpful for me.
import fitz
import os
pdfFiles = []
for filename in os.listdir('resume/'):
if filename.endswith('.pdf'):
print(filename)
os.chdir('C:/Users/M. Abrar Hussain/Desktop/cv/resume')
pdfFileObj = open(filename, 'rb')
with fitz.open(pdfFileObj) as doc:
text = ""
for page in doc:
text += page.getText()
print(text)
p = doc.loadPage(0)
p_text = p.getText()
p_lines = p_text.splitlines()
print(p_lines)
search_keywords = ['Laravel', 'Java', 'Python']
# Comparing data with keywords
lst = []
for sentence in p_lines:
for word in search_keywords:
if word in sentence:
lst.append(word)
print(lst)
score = 0
w1 = []
for w1 in lst:
if w1 == 'Laravel':
score = score + 2
if w1 == 'Python':
score = score + 2
if w1 == 'Java':
score = score + 1
print("The candidate has Score = %i" % score)
print('\n')
pdfFileObj.close()
The output of this Code is
cv1.pdf
Name: M. Abrar Hussain
GPA: 3.5
Skills: Python, Laravel
Experience: 3 yr
['Name: M. Abrar Hussain ', 'GPA: 3.5 ', 'Skills: Python, Laravel ', 'Experience: 3 yr ']
['Laravel', 'Python']
The candidate has Score = 4
cv2.pdf
Name: Danish Ejaz
GPA: 3.7
Skills: Python, Java
Experience: 2.5 yr
['Name: Danish Ejaz ', 'GPA: 3.7 ', 'Skills: Python, Java ', 'Experience: 2.5 yr ']
['Java', 'Python']
The candidate has Score = 3
cv3.pdf
Name: Abdullah
GPA: 3.2
Skills: Laravel, Java
Experience: 2 yr
['Name: Abdullah ', 'GPA: 3.2 ', 'Skills: Laravel, Java ', 'Experience: 2 yr ']
['Laravel', 'Java']
The candidate has Score = 3
Process finished with exit code 0
In this output we able to compare the Skills with the KeyWord and give them Score. Now our main focus is to extract the GPA value form the string and give score after comparison as we did earlier to the Skills