-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPythonWordCloud.py
More file actions
36 lines (26 loc) · 1.52 KB
/
PythonWordCloud.py
File metadata and controls
36 lines (26 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#Configurations blended from https://towardsdatascience.com/how-to-easily-make-beautiful-wordclouds-in-python-55789102f6f5#
#Instructions
#Take your word document and save it as a PDF or txt document and place it in the same folder as the python script and or alter the path. Ensure that you change the file name to match your file
#Sometimes it will take multiple times with complex word documents and formatting.
#In this script comments.txt is the file that will be analyzed
from stop_words import get_stop_words
import stylecloud
#Insert the additional stop words here#
#Use this section to remove words that may clutter the picture, if you don't have any you can comment or remove these out
stop_words = get_stop_words('english')
stop_words.append('MRO')
stop_words.append('Marine')
stop_words.append('Concurs')
stop_words.append('Marines')
stop_words.append('Peer')
stop_words.append('Concur')
stop_words.append('Peers')
stop_words.append('Continue')
stop_words.append('RS')
stop_words.append('Detachment')
stop_words.append('Challenge')
stop_words.append('Sgt')
stop_words.append('Can')
#Website to choose the design of the cloud https://fontawesome.com/icons?d=gallery&p=2&m=free#
#Can remove palette command below to use default colors. Chose pallete from https://jiffyclub.github.io/palettable/
stylecloud.gen_stylecloud(file_path='comments.txt', icon_name= "fas fa-cloud", palette='colorbrewer.diverging.RdBu_11', custom_stopwords=stop_words) #Icon name is where you can go to the above website to change the style of the word cloud