Skip to content

Commit

Permalink
Merge pull request #617 from momithalasya/ats-score-finder
Browse files Browse the repository at this point in the history
Ats score finder
  • Loading branch information
GarimaSingh0109 authored Oct 15, 2024
2 parents 623fedc + 530fd06 commit e797cd5
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 0 deletions.
199 changes: 199 additions & 0 deletions ats_score_finder.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resume ATS Score Finder</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" integrity="sha384-k6RqeWeci5ZR/Lv4MR0sA0FfDOMR5aN2eW1u1a1G6T8G6Fz2F4zS3z7P8S5f5WJ" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.4.2/mammoth.browser.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f4f4f4;
color: #333;
}
h1 {
text-align: center;
}
.heading{
background-color:#045D5D ;
height:200px;
margin-bottom:60px;
color:white;
width:100%;
justify-content:center;
}
.container {
max-width: 800px;
margin: auto;
background: #d9c79e;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
color:#2f4f4f;
}
button {
width: 100%;
padding: 10px;
background-color: #28a745;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #218838;
}
#score {
font-size: 24px;
font-weight: bold;
text-align: center;
margin-top: 20px;
}
#feedback {
text-align: center;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="heading">
<br><br><br>
<h1>Resume ATS Score Finder</h1>
</div>

<div class="container">
<h1>Resume ATS Score Finder</h1>
<label for="job-description">Enter Job Description:</label>
<textarea id="job-description" rows="4" style="width: 100%;" placeholder="Enter the job description here..."></textarea>

<label for="resume-upload">Upload Your Resume (PDF or Word):</label>
<input type="file" id="resume-upload" accept=".pdf, .docx" />

<label for="resume-text">Or Paste Your Resume Text Here:</label>
<textarea id="resume-text" rows="4" style="width: 100%;" placeholder="Paste your resume text..."></textarea>

<button id="analyze-button">Analyze Resume</button>

<div id="score">ATS Compatibility Score: 0%</div>
<div id="feedback"></div>
</div>

<script>
// Event listener for the analyze button
document.getElementById("analyze-button").addEventListener("click", function() {
const jobDescription = document.getElementById("job-description").value;
const resumeText = document.getElementById("resume-text").value.trim();

// Handle file upload
const fileInput = document.getElementById("resume-upload");
const file = fileInput.files[0];

// If both fields are empty, alert the user
if (!jobDescription || (!resumeText && !file)) {
alert("Please enter the job description and provide either a resume text or upload a file.");
return;
}

// If there's a file, process it
if (file) {
const reader = new FileReader();

reader.onload = function(event) {
const arrayBuffer = event.target.result;

if (file.type === "application/pdf") {
// PDF file handling
pdfjsLib.getDocument(arrayBuffer).promise.then(function(pdf) {
pdf.getPage(1).then(function(page) {
page.getTextContent().then(function(textContent) {
const textItems = textContent.items;
const resumeTextFromFile = textItems.map(item => item.str).join(" ");
analyzeResume(jobDescription, resumeText || resumeTextFromFile);
});
});
});
} else if (file.type === "application/vnd.openxmlformats-officedocument.wordprocessingml.document") {
// Word file handling
mammoth.extractRawText({arrayBuffer: arrayBuffer})
.then(function(result) {
const resumeTextFromFile = result.value; // The plain text
analyzeResume(jobDescription, resumeText || resumeTextFromFile);
})
.catch(function(err) {
console.error("Error reading Word file:", err);
});
} else {
alert("Unsupported file type. Please upload a PDF or Word document.");
}
};

reader.readAsArrayBuffer(file);
} else {
analyzeResume(jobDescription, resumeText); // Analyze with pasted text
}
});

// Function to analyze resume text
function analyzeResume(jobDescription, resumeText) {
if (jobDescription && resumeText) {
const atsScore = calculateATSScore(jobDescription, resumeText);
const feedback = displayFeedback(atsScore);
const formatFeedback = checkFormattingAndStructure(resumeText);

document.getElementById("score").innerText = "ATS Compatibility Score: " + atsScore + "%";
document.getElementById("feedback").innerText = feedback + " " + formatFeedback;
} else {
document.getElementById("feedback").innerText = "Please enter both the job description and resume.";
}
}

// Function to calculate ATS score based on job description keywords
function calculateATSScore(jobDescription, resumeText) {
// Extract keywords from job description
const jobKeywords = jobDescription.toLowerCase().match(/\b\w+\b/g) || [];
const resumeKeywords = resumeText.toLowerCase().match(/\b\w+\b/g) || [];
let matchingKeywords = 0;

jobKeywords.forEach(keyword => {
if (resumeKeywords.includes(keyword)) {
matchingKeywords++;
}
});

// Calculate score based on matching keywords
return ((matchingKeywords / jobKeywords.length) * 100).toFixed(2);
}

// Function to display feedback based on ATS score
function displayFeedback(atsScore) {
if (atsScore >= 80) {
return "Great! Your resume matches well with the job description.";
} else if (atsScore >= 50) {
return "Good job! Consider adding more relevant keywords.";
} else {
return "Your resume needs improvement. Focus on matching key skills.";
}
}

// Function to check formatting and structure
function checkFormattingAndStructure(resumeText) {
const lines = resumeText.split('\n');
const hasHeading = lines.some(line => line.trim().toLowerCase().includes("education") || line.trim().toLowerCase().includes("experience"));
const hasBulletPoints = lines.some(line => line.trim().startsWith("-") || line.trim().startsWith("•"));

if (!hasHeading) {
return "Consider adding clear headings (e.g., Education, Experience).";
}
if (!hasBulletPoints) {
return "Using bullet points can improve readability.";
}
return "Your formatting looks good!";
}
</script>

</body>
</html>
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@
<a href="about.html">About</a>
<a href="resume.html">Build Resume</a>
<a href="resume_tips.html">Resume Tips</a>
<li><a href="ats_score_finder.html">ATS Score Finder</a></li>
<a href="login.html">Login</a>
</nav>

Expand Down Expand Up @@ -1217,6 +1218,7 @@ <h3>Services</h3>
<li><a href="#">Resume Builder</a></li>
<li><a href="#">CV Templates</a></li>
<li><a href="#">Career Advice</a></li>

</ul>
</div>
<div class="footer-section">
Expand Down

0 comments on commit e797cd5

Please sign in to comment.