-
Notifications
You must be signed in to change notification settings - Fork 0
/
complexPostStats.py
executable file
·85 lines (62 loc) · 2.06 KB
/
complexPostStats.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from scipy import mean, std, stats
from scipy.stats import sem
tabooList = ['Race/Protected Groups', 'Death', 'Academics', 'Drugs', 'Medical', 'Mental Health', 'Money/Financial', 'Excretions', 'Sex']
stigmaList = ["Group","Character","External"]
questionList = ['Social Connection/Invitation', 'Opinion/Recommendation', 'Offer', 'Factual Knowledge', 'Rhetorical']#,'None']
def complexStats():
lines = open("StatsForPosts.csv").readlines()[1:]
count = {}
for stigma in stigmaList:
count[stigma] = {}
for questionType in questionList:
count[stigma][questionType] = 0
for line in lines:
cols = line.split("|")
isCoded = cols[11]
if "Y" not in isCoded:
continue
taboo = cols[12]
stigma = cols[13]
isGenuineQuestion = cols[14]
questionType = cols[15]
if "Y" not in isGenuineQuestion:
continue
if "None" in stigma or "None" in questionType:
continue
#count[taboo][stigma] += 1
count[stigma][questionType] += 1
x = []
#for stigma in stigmaList:
for questionType in questionList:
for stigma in stigmaList:
print stigma, questionType
x += [count[stigma][questionType]]
print "Taboo and Questions"
print "x = c( [2, 0, 0, 2, 1, 2, 0, 0, 2, 118, 4, 26, 30, 16, 26, 23, 41, 130, 0, 0, 0, 0, 0, 0, 0, 0, 1, 10, 2, 1, 3, 3, 1, 0, 3, 6, 62, 8, 13, 26, 12, 9, 24, 41, 82]"
print "Stigma and Questions"
print "x = c(",x
def LIWCStats():
lines = open("StatsForLIWCPosts.csv").readlines()[1:]
tabooList = ['Race/Protected Groups', 'Death', 'Academics', 'Drugs', 'Medical', 'Mental Health', 'Money/Financial', 'Excretions', 'Sex']
category = {}
for taboo in tabooList:
category[taboo] = []
for line in lines:
cols = line.split("|")
if "Y" not in cols[75]: #isCoded
continue
taboo = cols[76]
stigma = cols[77]
if "None" in taboo:
continue
category[taboo] += [int(cols[19])] #Ppron
Mean, SEM = [],[]
for taboo in tabooList:
Mean += [mean(category[taboo])]
SEM += [sem(category[taboo])]
print "Ipron"
print Mean
print SEM
def CategoryStats():
lines = open("StatsForPosts.csv").readlines()[1:]
#LIWCStats()