Skip to content

Instantly share code, notes, and snippets.

@harismohamed
Last active December 14, 2023 03:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harismohamed/88891a43ca57cff93d24f37a8798c9f5 to your computer and use it in GitHub Desktop.
Save harismohamed/88891a43ca57cff93d24f37a8798c9f5 to your computer and use it in GitHub Desktop.
A resume optimizer application utilizing word cloud generator by Andreas Mueller
"""
Word Cloud Resume Optimizer
By Mohamed Haris
GitHub ID: @harismohamed
"""
#install and import required libraries
!pip install python-docx
!pip install wordcloud
from docx import Document
from wordcloud import WordCloud, STOPWORDS
import matplotlib as mpl
import matplotlib.pyplot as plt
#set path for resume file
myresume="C:\\temp\\my_resume.docx"
#read the document
doc = Document(myresume)
#collect text from each paragraph
resumetext = ""
text = []
for para in doc.paragraphs:
text.append(para.text)
resumetext = '\n'.join(text)
stopwords = set(STOPWORDS)
#add custom stop words for better results
#custom stopwords may be stored in a text file
custstopwordsfile="C:\\temp\\stopwords.txt"
f=open(custstopwordsfile,'r')
custstopwords=f.read().splitlines()
f.close()
#add custom stop words to the default ones
stopwords.update(custstopwords)
#instantiate a word cloud object
resume_wc = WordCloud(
background_color='black',
stopwords=stopwords)
#adjust the image rendering area
fig = plt.figure()
fig.set_figwidth(12) # set width
fig.set_figheight(16) # set height
#generate the word cloud
resume_wc.generate(resumetext)
plt.imshow(resume_wc, interpolation='bilinear')
plt.axis('off')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment