A code snippet written in python to get tweets from a csv file and get the % of profanity and store them in a formatted output file
There are three files included in this repo:
profanity.py
-> main script used to check profanitytweets.csv
-> formatted input fileprofanity_degree.txt
-> formatted output file
- Copy/Create the
tweets.csv
file in the same directory as theprofanity.py
script - Run
profanity.py
the results should be stored inprofanity_degree.txt
- I have assumed that the input file is formated as a csv file in the format
<index>, <tweetID>, <tweet>
- I have assumed that the profanity ratio uses the formula
(number of slurs)/(total number of words in tweet) * 100
- I have assumed that the output is in the format
<index> - <tweetID> - <profanity%> - <found slur words>