The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Create a résumé keyword density checker

Here’s a Python script that acts as a résumé keyword density checker. It will take a résumé text and a list of keywords, then calculate the density (percentage) of each keyword in the résumé.

python
import re from collections import Counter def clean_text(text): # Lowercase and remove non-alphanumeric characters (except spaces) text = text.lower() text = re.sub(r'[^a-z0-9s]', '', text) return text def keyword_density(resume_text, keywords): cleaned_text = clean_text(resume_text) words = cleaned_text.split() total_words = len(words) word_counts = Counter(words) density_results = {} for keyword in keywords: # Support multi-word keywords keyword_clean = clean_text(keyword) keyword_words = keyword_clean.split() if len(keyword_words) == 1: count = word_counts[keyword_clean] else: # Count occurrences of multi-word phrase in text pattern = r'b' + r's+'.join(keyword_words) + r'b' count = len(re.findall(pattern, cleaned_text)) density = (count / total_words) * 100 if total_words > 0 else 0 density_results[keyword] = {'count': count, 'density': round(density, 2)} return density_results # Example usage: resume = """ Experienced software developer skilled in Python, Java, and cloud technologies. Strong background in developing scalable applications and working with agile teams. """ keywords = ['Python', 'Java', 'cloud', 'Agile', 'scalable applications', 'C++'] densities = keyword_density(resume, keywords) for k, v in densities.items(): print(f"Keyword: '{k}' - Count: {v['count']}, Density: {v['density']}%")

How it works:

  • Converts résumé text and keywords to lowercase and strips punctuation.

  • Supports both single-word and multi-word keywords.

  • Calculates count and percentage density based on total word count.

If you’d like, I can also build this as a web app or Excel macro. Let me know!

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About