-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlolchatanalysis.html
277 lines (245 loc) · 11.3 KB
/
lolchatanalysis.html
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="assets/ico/favicon.ico">
<title>Kyle Young</title>
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="assets/css/style.css" rel="stylesheet">
<link href="assets/css/font-awesome.min.css" rel="stylesheet">
<!--CSS for code -->
<link href="assets/css/prism.css" rel="stylesheet" />
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-33714836-2', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Kyle Young</a>
</div>
<div class="navbar-collapse collapse navbar-right">
<ul class="nav navbar-nav">
<li><a href="index.html">HOME</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">PROJECTS <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="projects.html">Overview</a></li>
<li><a href="lolchatanalysis.html">League of Legends</a></li>
<li><a href="texasanalysis.html">Last Words</a></li>
</ul>
</li>
<li><a href="courses.html">COURSES</a></li>
<li><a href="blog.html">BLOG</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<!-- *****************************************************************************************************************
BLUE WRAP
***************************************************************************************************************** -->
<div id="blue">
<div class="container">
<div class="row">
<h3>League of Legends Project.</h3>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /blue -->
<div class="container mtb">
<div class="row">
<div class="col-lg-6">
<h3 class="ctitle">Importing/Exporting the data:</h3>
<p><b>Comment:</b> Since CouchDB works natively with JSON, importing all the files was straightfoward. The only hiccup was that I put dashes in a variable name when getting the JSON files so I had to remove them (using replace in Sublime Text).</p>
<p>In terms of exporting , I used a list function to save the CouchDB output into a text file.</p>
<p>After that, I sorted the files by value (in Java) to make it easier to find meaning in the data. Otherwise I'd have to look through every entry myself</p>
</div>
<div class="col-lg-6">
<h4>Loading JSON files into CouchDB (Bash):</h4>
<pre class="language-bash"><code class="language-bash">#!/bin/bash
#json files in current directory
for i in *.json; do
cat $i | POST -sS "http://127.0.0.1:5984/tribunal/" -c "application/json"
done
</code></pre>
<h4>Layout of JSON files:</h4>
<pre class="language-JSON"><code class="language-JSON">{
results:[
{
url:"url"
reportedplayer:[
{
player: "player",
message: "message",
time: "time"
}
],
summary:[
{
decision: "decision",
punishment: "punishment"
}]}]}</code></pre>
<h4>List Function</h4>
<pre class="language-javascript"><code class="language-javascript">function(head,req) {
while(row = getRow()){
send(row.key +\" \"+ row.value +\"\\n\");
}
}</code></pre>
</div>
</div><! --/row -->
<div class="spacing"></div>
<div class="hline"></div>
<div class="spacing"></div>
<div class="row">
<div class="col-lg-6">
<h3 class="ctitle">Outcomes Findings: </h3>
<p><b>None:</b> 1516 <br><b>Warning: </b>3457<br><b>Time ban:</b> 3714<br><b>Permanent ban:</b> 330</p>
<p><b>Comment: </b>I think these numbers make sense from my league experience. The only place I was a little suprised was that I expected more warnings than time bans, not the inverse.</p>
</div>
<div class="col-lg-6">
<h4>Mapper code</h4>
<pre class="language-javascript"><code class="language-javascript">function(doc) {
for(var i = 0; i < doc.results.length; i++){
if(doc.results[i].summary){
for(var j = 0; j < doc.results[i].summary.length;j++){
emit(doc.results[i].summary[j].punishment,1);
}
}
}
}</code></pre>
<h4>Reducer code</h4>
<pre class="language-javascript"><code class="language-javascript">_sum</code></pre>
</div>
</div><! --/row -->
<div class="spacing"></div>
<div class="hline"></div>
<div class="spacing"></div>
<div class="row">
<div class="col-lg-6">
<h3 class="ctitle">Chat Times Findings:</h3>
<p><b>Comment:</b> Didn't really find anything intersting, players seemed to talk about the same time everywhere with a spike at the beginning and tapering at the end.</p>
</div>
<div class="col-lg-6">
<h4>Mapper code</h4>
<pre class="language-javascript"><code class="language-javascript">function(doc) {
for(var i = 0; i < doc.results.length; i++){
if(doc.results[i].reportedplayer){
for(var j = 0; j < doc.results[i].reportedplayer.length;j++){
emit(doc.results[i].reportedplayer[j].time,1);
}
}
}
}</code></pre>
<h4>Reducer code</h4>
<pre class="language-javascript"><code class="language-javascript">_sum</code></pre>
</div>
</div><! --/row -->
<div class="spacing"></div>
<div class="hline"></div>
<div class="spacing"></div>
<div class="row">
<div class="col-lg-6">
<h3 class="ctitle">Champions Findings: </h3>
<p><b>Most vocal champions: </b><br>1) Ezreal <br> 2) Lee Sin <br> 3) Teemo (aka Satan) <br> 4) Katarina <br> 5) Darius <br> 6) Master Yi</p>
<p><b>Most tribunal appearances: </b><br>1) Ezreal <br> 2) Taric <br> 3) Lee Sin <br> 4) Master Yi <br> 5) Katarina <br> 6) Jax</p>
<p><b>Comment: </b>This section has two parts, one for how many times a champion appeared in the tribunal, and one for how many times each champion sent a message. The code for both of them are similar, for the first case I just send one count per case while for the latter I sent a count for every message.</p>
<p>After this mapper code is run, the key returned may have an [All] next to it if the player sent their first message via all chat so I deleted that with replaceAll in Sublime Text. I also had to write a quick Java program to combine the two lines into one.</p>
</div>
<div class="col-lg-6">
<h4>Mapper code</h4>
<pre class="language-javascript"><code class="language-javascript">function(doc) {
for(var i = 0; i < doc.results.length; i++){
if(doc.results[i].reportedplayer){
for(var j = 0; j < doc.results[i].reportedplayer.length;j++){
emit(doc.results[i].reportedplayer[j].player,1);
}
}
}
}</code></pre>
<h4>Reducer code</h4>
<pre class="language-javascript"><code class="language-javascript">_sum</code></pre>
</div>
</div><! --/row -->
<div class="spacing"></div>
<div class="hline"></div>
<div class="spacing"></div>
<div class="row">
<div class="col-lg-6">
<h3 class="ctitle">Chat Text Findings: </h3>
<p><b>Word occurances: </b> <br><b>Noob: </b> 2778 <br><b>Report: </b> 3092 <br></p>
<p><b>Comment: </b>Since there are slight variations in messages, doing a straight count of whole sentences would be useless. Also, doing an extremely complicated analysis is out of my scope so I settled with something manageable. I decided to go with a simple word count. I'll add more words if I think of more interesting ones.</p>
</div>
<div class="col-lg-6">
<h4>Mapper code</h4>
<pre class="language-javascript"><code class="language-javascript">function(doc) {
for(var i = 0; i < doc.results.length; i++){
if(doc.results[i].summary){
for(var j = 0; j < doc.results[i].summary.length;j++){
emit(doc.results[i].reportedplayer[j].message,1);
}
}
}
}</code></pre>
<h4>Reducer code</h4>
<pre class="language-javascript"><code class="language-javascript">_sum</code></pre>
</div>
</div><! --/row -->
<div class="spacing"></div>
<div class="hline"></div>
<div class="spacing"></div>
<div class="row">
<div class="col-lg-6">
<h3 class="ctitle">Time Findings (WIP): </h3>
<p><b>Comment: </b></p>
</div>
<div class="col-lg-6">
<h4>Mapper code</h4>
<pre class="language-javascript"><code class="language-javascript"></code></pre>
<h4>Reducer code</h4>
<pre class="language-javascript"><code class="language-javascript"></code></pre>
</div>
</div><! --/row -->
<div class="spacing"></div>
<div class="hline"></div>
<div class="spacing"></div>
</div><! --/container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/retina-1.1.0.js"></script>
<script src="assets/js/jquery.hoverdir.js"></script>
<script src="assets/js/jquery.hoverex.min.js"></script>
<script src="assets/js/jquery.prettyPhoto.js"></script>
<script src="assets/js/jquery.isotope.min.js"></script>
<script src="assets/js/custom.js"></script>
<!-- JS for code -->
<script src="assets/js/prism.js"></script>
</body>
</html>