Skip to content

Instantly share code, notes, and snippets.

@manvillej
Last active November 27, 2019 17:22
Show Gist options
  • Save manvillej/3ef9fa694a1b30c68c06547585498e51 to your computer and use it in GitHub Desktop.
Save manvillej/3ef9fa694a1b30c68c06547585498e51 to your computer and use it in GitHub Desktop.
import csv
import pandas as pd
import random
import re
file_path = 'C:/Users/Jenny/Desktop/BU COM/Fall 2019/EM 855 Comp Assisted Text Analysis/Research Project/Data/Cursing_Lexicon_05.11.17.txt'
file_export = 'C:/Users/Jenny/Desktop/BU COM/Fall 2019/EM 855 Comp Assisted Text Analysis/Research Project/Data/Cursing_Lexicon_in_one_line.txt'
uncivil_dictionary = open(file_path, 'r')
dictionary = open(file_export, 'w+')
lines = uncivil_dictionary.readlines()
print(lines)
words = "|".join([re.escape(word) for word in test])[:-1]
dictionary.write(words)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment