Skip to content

Commit 7cd3373

Browse files
author
Christian Staudte
committed
replaced path stopwords and added topics xml
1 parent 6f2f8b5 commit 7cd3373

File tree

6 files changed

+268
-11
lines changed

6 files changed

+268
-11
lines changed

Diff for: argU/__main__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
ROOT_PATH, 'argU/sentiment/results/argument_sentiments.csv'
2525
)
2626
FOUND_ARGUMENTS_PATH = os.path.join(RESOURCES_PATH, 'scores.csv')
27-
RESULTS_PATH = os.path.join(RESOURCES_PATH, 'results.txt')
28-
QUERIES_PATH = os.path.join(RESOURCES_PATH, 'topics-automatic-runs-task-1.xml')
27+
RESULTS_PATH = os.path.join(ROOT_PATH, 'run.txt')
28+
QUERIES_PATH = os.path.join(ROOT_PATH, 'topics.xml')
2929

3030
bm_25_splits = BM25_STORE_PATH.split('.')
3131
BM25_PARTIONAL_PATHS = [

Diff for: argU/preprocessing/tokenizing.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
ROOT_PATH = rootpath.detect()
77
RESOURCES_PATH = os.path.join(ROOT_PATH, 'resources/')
8-
STOPWORDS_PATH = os.path.join(RESOURCES_PATH, 'stopwords_eng.txt')
8+
STOPWORDS_PATH = os.path.join(ROOT_PATH, 'stopwords_eng.txt')
99

1010
# nltk.download()
11+
12+
1113
def tokenizing_q(query: str):
1214
punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''
1315
stopwords = open(STOPWORDS_PATH, "r").read().split("\n")
@@ -31,10 +33,10 @@ def tokenizing_q(query: str):
3133
# if l.antonyms():
3234
# antonyms.append(l.antonyms()[0].name())
3335
for s, syno in enumerate(synonyms):
34-
syno.replace("_"," ")
35-
synonyms[s]= syno
36+
syno.replace("_", " ")
37+
synonyms[s] = syno
3638
for s, syno in enumerate(synonyms):
37-
for j,syno2 in enumerate(synonyms):
39+
for j, syno2 in enumerate(synonyms):
3840
if j > s:
3941
if syno2 == syno:
4042
synonyms[j] = ""

Diff for: argU/preprocessing/tools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
ROOT_PATH = rootpath.detect()
1818
RESOURCES_PATH = os.path.join(ROOT_PATH, 'resources/')
19-
STOPWORDS_PATH = os.path.join(RESOURCES_PATH, 'stopwords_eng.txt')
19+
STOPWORDS_PATH = os.path.join(ROOT_PATH, 'stopwords_eng.txt')
2020

2121

2222
def url_cleaning(text):

Diff for: argU/sentiment/nltk.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
from nltk.tokenize import word_tokenize
77
from nltk import FreqDist, classify, NaiveBayesClassifier, download as nltk_download
88

9-
import re, string, random
9+
import re
10+
import string
11+
import random
1012

1113

1214
def get_nltk_data():
@@ -90,8 +92,10 @@ def run(rows, mode):
9092
freq_dist_pos = FreqDist(all_pos_words)
9193
print(freq_dist_pos.most_common(10))
9294

93-
positive_tokens_for_model = get_tweets_for_model(positive_cleaned_tokens_list)
94-
negative_tokens_for_model = get_tweets_for_model(negative_cleaned_tokens_list)
95+
positive_tokens_for_model = get_tweets_for_model(
96+
positive_cleaned_tokens_list)
97+
negative_tokens_for_model = get_tweets_for_model(
98+
negative_cleaned_tokens_list)
9599

96100
positive_dataset = [
97101
(tweet_dict, "Positive") for tweet_dict in positive_tokens_for_model

Diff for: tests/quality_check_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ROOT_PATH = rootpath.detect()
1313
RESOURCES_PATH = os.path.join(ROOT_PATH, 'resources/')
1414
CSV_PATH = os.path.join(RESOURCES_PATH, 'args-me.csv')
15-
STOPWORDS_PATH = os.path.join(RESOURCES_PATH, 'stopwords_eng.txt')
15+
STOPWORDS_PATH = os.path.join(ROOT_PATH, 'stopwords_eng.txt')
1616

1717

1818
# def split_concatenated_words(text):

Diff for: topics.xml

+251
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
<topics>
2+
<topic>
3+
<num>1</num>
4+
<title>Should Teachers Get Tenure?</title>
5+
</topic>
6+
7+
<topic>
8+
<num>2</num>
9+
<title>Is Vaping with E-Cigarettes Safe?</title>
10+
</topic>
11+
12+
<topic>
13+
<num>3</num>
14+
<title>Should Insider Trading Be Allowed?</title>
15+
</topic>
16+
17+
<topic>
18+
<num>4</num>
19+
<title>Should Corporal Punishment Be Used in Schools?</title>
20+
</topic>
21+
22+
<topic>
23+
<num>5</num>
24+
<title>Should Social Security Be Privatized?</title>
25+
</topic>
26+
27+
<topic>
28+
<num>6</num>
29+
<title>Is a College Education Worth It?</title>
30+
</topic>
31+
32+
<topic>
33+
<num>7</num>
34+
<title>Should Felons Who Have Completed Their Sentence Be Allowed to Vote?</title>
35+
</topic>
36+
37+
<topic>
38+
<num>8</num>
39+
<title>Should Abortion Be Legal?</title>
40+
</topic>
41+
42+
<topic>
43+
<num>9</num>
44+
<title>Should Students Have to Wear School Uniforms?</title>
45+
</topic>
46+
47+
<topic>
48+
<num>10</num>
49+
<title>Should Any Vaccines Be Required for Children?</title>
50+
</topic>
51+
52+
<topic>
53+
<num>11</num>
54+
<title>Should Performance Enhancing Drugs Be Accepted in Sports?</title>
55+
</topic>
56+
57+
<topic>
58+
<num>12</num>
59+
<title>Should birth control pills be available over the counter?</title>
60+
</topic>
61+
62+
<topic>
63+
<num>13</num>
64+
<title>Can Alternative Energy Effectively Replace Fossil Fuels?</title>
65+
</topic>
66+
67+
<topic>
68+
<num>14</num>
69+
<title>Is Sexual Orientation Determined at Birth?</title>
70+
</topic>
71+
72+
<topic>
73+
<num>15</num>
74+
<title>Should Animals Be Used for Scientific or Commercial Testing?</title>
75+
</topic>
76+
77+
<topic>
78+
<num>16</num>
79+
<title>Should Prescription Drugs Be Advertised Directly to Consumers?</title>
80+
</topic>
81+
82+
<topic>
83+
<num>17</num>
84+
<title>Should Recreational Marijuana Be Legal?</title>
85+
</topic>
86+
87+
<topic>
88+
<num>18</num>
89+
<title>Should Churches Remain Tax-Exempt?</title>
90+
</topic>
91+
92+
<topic>
93+
<num>19</num>
94+
<title>Should Gay Marriage Be Legal?</title>
95+
</topic>
96+
97+
<topic>
98+
<num>20</num>
99+
<title>Is Drinking Milk Healthy for Humans?</title>
100+
</topic>
101+
102+
<topic>
103+
<num>21</num>
104+
<title>Is Human Activity Primarily Responsible for Global Climate Change?</title>
105+
</topic>
106+
107+
<topic>
108+
<num>22</num>
109+
<title>Is a Two-State Solution an Acceptable Solution to the Israeli-Palestinian Conflict?</title>
110+
</topic>
111+
112+
<topic>
113+
<num>23</num>
114+
<title>Should Euthanasia or Physician-Assisted Suicide Be Legal?</title>
115+
</topic>
116+
117+
<topic>
118+
<num>24</num>
119+
<title>Does Lowering the Federal Corporate Income Tax Rate Create Jobs?</title>
120+
</topic>
121+
122+
<topic>
123+
<num>25</num>
124+
<title>Should Tablets Replace Textbooks in Schools?</title>
125+
</topic>
126+
127+
<topic>
128+
<num>26</num>
129+
<title>Do Standardized Tests Improve Education?</title>
130+
</topic>
131+
132+
<topic>
133+
<num>27</num>
134+
<title>Should More Gun Control Laws Be Enacted?</title>
135+
</topic>
136+
137+
<topic>
138+
<num>28</num>
139+
<title>Should Prostitution Be Legal?</title>
140+
</topic>
141+
142+
<topic>
143+
<num>29</num>
144+
<title>Should the Government Allow Illegal Immigrants to Become Citizens?</title>
145+
</topic>
146+
147+
<topic>
148+
<num>30</num>
149+
<title>Should Adults Have the Right to Carry a Concealed Handgun?</title>
150+
</topic>
151+
152+
<topic>
153+
<num>31</num>
154+
<title>Is Obesity a Disease?</title>
155+
</topic>
156+
157+
<topic>
158+
<num>32</num>
159+
<title>Do Electronic Voting Machines Improve the Voting Process?</title>
160+
</topic>
161+
162+
<topic>
163+
<num>33</num>
164+
<title>Should People Become Vegetarian?</title>
165+
</topic>
166+
167+
<topic>
168+
<num>34</num>
169+
<title>Are Social Networking Sites Good for Our Society?</title>
170+
</topic>
171+
172+
<topic>
173+
<num>35</num>
174+
<title>Do Violent Video Games Contribute to Youth Violence?</title>
175+
</topic>
176+
177+
<topic>
178+
<num>36</num>
179+
<title>Is Golf a Sport?</title>
180+
</topic>
181+
182+
<topic>
183+
<num>37</num>
184+
<title>Is Cell Phone Radiation Safe?</title>
185+
</topic>
186+
187+
<topic>
188+
<num>38</num>
189+
<title>Should Marijuana Be a Medical Option?</title>
190+
</topic>
191+
192+
<topic>
193+
<num>39</num>
194+
<title>Should the Federal Minimum Wage Be Increased?</title>
195+
</topic>
196+
197+
<topic>
198+
<num>40</num>
199+
<title>Should the Death Penalty Be Allowed?</title>
200+
</topic>
201+
202+
<topic>
203+
<num>41</num>
204+
<title>Should Student Loan Debt Be Easier to Discharge in Bankruptcy?</title>
205+
</topic>
206+
207+
<topic>
208+
<num>42</num>
209+
<title>Should Fighting Be Allowed in Hockey?</title>
210+
</topic>
211+
212+
<topic>
213+
<num>43</num>
214+
<title>Should Bottled Water Be Banned?</title>
215+
</topic>
216+
217+
<topic>
218+
<num>44</num>
219+
<title>Should Election Day be a National Holiday?</title>
220+
</topic>
221+
222+
<topic>
223+
<num>45</num>
224+
<title>Should the Penny Stay in Circulation?</title>
225+
</topic>
226+
227+
<topic>
228+
<num>46</num>
229+
<title>Should Net Neutrality Be Restored?</title>
230+
</topic>
231+
232+
<topic>
233+
<num>47</num>
234+
<title>Is Homework Beneficial?</title>
235+
</topic>
236+
237+
<topic>
238+
<num>48</num>
239+
<title>Should the the Voting Age be Lowered?</title>
240+
</topic>
241+
242+
<topic>
243+
<num>49</num>
244+
<title>Should Body Cameras be Mandatory for Police?</title>
245+
</topic>
246+
247+
<topic>
248+
<num>50</num>
249+
<title>Should Everyone Get a Universal Basic Income?</title>
250+
</topic>
251+
</topics>

0 commit comments

Comments
 (0)