Created
December 27, 2018 05:50
-
-
Save lettergram/5270b0a58b440c1c24ed319886ce1a68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pulls all the data from the manually generated imparatives dataset | |
with open('data/imperatives.csv', 'r') as imperative_file: | |
for row in imperative_file: | |
tagged_comments[imperative] = "command" | |
# Pulls all data from the SPAADIA dataset, adds to our dataset | |
for doc in os.listdir('data/SPAADIA'): | |
with open('data/SPAADIA/' + doc, 'r') as handle: | |
conversations = BeautifulSoup(handle, features="xml") | |
for imperative in conversations.findAll("imp"): | |
tagged_comments[imperative.get_text()] = "command" | |
for declarative in conversations.findAll("decl"): | |
tagged_comments[declarative.get_text()] = "statement" | |
for question in conversations.findAll("q-yn"): | |
tagged_comments[question.get_text()] = "question" | |
for question in conversations.findAll("q-wh"): | |
tagged_comments[question.get_text()] = "question" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment