0% found this document useful (0 votes)
4 views7 pages

NLP Project

The document describes a lab project called 'Resumely' that extracts contact details and skills from PDF resumes using a Streamlit application. It includes code snippets for the app and a utility extractor, detailing the process of uploading resumes, extracting data, and saving the results to an Excel file. The extractor uses regular expressions and keyword matching to identify names, emails, phone numbers, and skills from the resume text.

Uploaded by

Ishavdeep Kaur
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

NLP Project

The document describes a lab project called 'Resumely' that extracts contact details and skills from PDF resumes using a Streamlit application. It includes code snippets for the app and a utility extractor, detailing the process of uploading resumes, extracting data, and saving the results to an Excel file. The extractor uses regular expressions and keyword matching to identify names, emails, phone numbers, and skills from the resume text.

Uploaded by

Ishavdeep Kaur
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LAB PROJECT

Contact details and skill extractor from Resume Pdfs.

[Link]

Code Snippet :
import streamlit as st
import pandas as pd
from [Link] import *

# ---------- PAGE CONFIG ----------


st.set_page_config(page_title="Resumely", layout="centered")

# ---------- CSS ----------


[Link]("""
<style>
/* Background fix */
[data-testid="stAppViewContainer"] {
background-color: #fef9e7 !important;
}

/* Remove header background */


[data-testid="stHeader"] {
background: transparent;
}

/* Upload box */
.upload-box {
text-align: center;
border: 2px dashed black;
padding: 25px;
border-radius: 15px;
margin-top: 30px;
}

/* Button style */
.stButton button {
border-radius: 12px;
Project Screenshot :
border: 2px solid black;
background-color: white;
font-weight: bold;
display: block;
margin: auto;
}
</style>
""", unsafe_allow_html=True)

# ---------- HERO SECTION ----------


[Link]("""
<div style="text-align:center;">
<p style="font-size:60px; font-family:'Comic Sans MS'; margin:0;">
Resumely
</p>

</div>
""", unsafe_allow_html=True)

# ---------- UPLOAD SECTION ----------


[Link]("""
<div class="upload-box">
<p style="font-size:18px;">Upload your resumes below</p>
<p style="font-size:14px;">Drag & drop or click to upload</p>
</div>
""", unsafe_allow_html=True)

uploaded_files = st.file_uploader(
"",
type=["pdf"],
accept_multiple_files=True
)

# ---------- EMPTY STATE ----------


if not uploaded_files:
[Link]("""
<div style="text-align:center; margin-top:20px;">
<p style="font-size:30px;"></p>
<p>No resumes uploaded yet</p>
</div>
""", unsafe_allow_html=True)

# ---------- PROCESS ----------


if [Link](" Extract Data"):
if not uploaded_files:
[Link]("Please upload at least one PDF.")
else:
with [Link]("Extracting data..."):
results = []

for file in uploaded_files:


text = extract_text(file)

[Link]({
"Name": extract_name(text),
"Email": extract_email(text),
"Phone": extract_phone(text),
"Skills": extract_skills(text)
})

df = [Link](results)

[Link]("Extraction Complete!")
[Link](df)

# Save Excel
output_path = "data/[Link]"
df.to_excel(output_path, index=False)

# Download
with open(output_path, "rb") as f:
st.download_button(
"Download Excel",
f,
file_name="[Link]"
)
[Link]

Code snippet :
import pdfplumber
import re

# Extract text from PDF


def extract_text(file):
text = ""
with [Link](file) as pdf:
for page in [Link]:
text += page.extract_text() or ""
return text

# Extract email using regex


def extract_email(text):
emails = [Link](r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}", text)
return emails[0] if emails else ""

# Extract phone number


def extract_phone(text):
phones = [Link](r"\+?\d[\d -]{8,12}\d", text)
return phones[0] if phones else ""

# Extract name (simple approach)


def extract_name(text):
lines = [Link]().split("\n")
return lines[0] if lines else ""

# Extract skills (keyword matching)


def extract_skills(text):
skills_db = [
"python", "java", "c++", "sql", "html", "css",
"machine learning", "data science"
]

found = []
for skill in skills_db:
if [Link]() in [Link]():
[Link](skill)

return ", ".join(found)

You might also like