-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.cgi
executable file
·106 lines (87 loc) · 6.06 KB
/
stats.cgi
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
print("Content-Type: text/html; charset=utf-8\n\n")
import sys
sys.stderr = sys.stdout
from speech_utils import *
print("""<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" type="text/css" href="https://patrickbrianmooney.nfshost.com/~patrick/css/content.css" />
<link rel="pgpkey" type="application/pgp-keys" href="/~patrick/505AB18E-public.asc" />
<link rel="author" href="http://plus.google.com/109251121115002208129?rel=author" />
<link rel="sitemap" href="/sitemap.xml" />
<link rel="home" href="/~patrick/" title="Home page" />
<link rel="meta" type="application/rdf+xml" title="FOAF" href="/~patrick/foaf.rdf" />
<meta name="foaf:maker" content="foaf:mbox_sha1sum '48a3091d919c5e75a5b21d2f18164eb4d38ef2cd'" />
<link rel="profile" href="http://microformats.org/profile/hcalendar" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="icon" type="image/x-icon" href="/~patrick/icons/favicon.ico" />
<title>Stats for Sarah Palin Quote, or Random Algorithmic Gibberish?</title>
<meta name="generator" content="Bluefish 2.2.11" />
<meta name="author" content="Patrick Mooney" />
<meta name="dcterms.rights" content="Copyright © 2016 Patrick Mooney" />
<meta name="description" content="Can Sarah Palin pass a crowdsourced Turing test?" />
<meta name="rating" content="general" />
<meta name="revisit-after" content="3 days" />
<meta name="date" content="2023-07-10T18:20:53-0500" />
<meta property="fb:admins" content="100006098197123" />
<meta property="og:title" content="Stats for Sarah Palin Quote, or Random Algorithmic Gibberish?" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://patrickbrianmooney.nfshost.com/~patrick/projects/sarah-palin/" />
<meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/SarahPalinElon.jpg/1280px-SarahPalinElon.jpg" />
<meta property="og:description" content="Can Sarah Palin pass a crowdsourced Turing test?" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@patrick_mooney" />
<meta name="twitter:creator" content="@patrick_mooney" />
<meta name="twitter:title" content="Stats for Sarah Palin Quote, or Random Algorithmic Gibberish?" />
<meta name="twitter:description" content="Can Sarah Palin pass a crowdsourced Turing test?" />
<meta name="twitter:image:src" content="https://upload.wikimedia.org/wikipedia/commons/thumb/a/ad/SarahPalinElon.jpg/1280px-SarahPalinElon.jpg" />
</head>
<body><div class="container">
<script type="text/javascript" src="/~patrick/nav.js"></script>
<noscript>
<p class="simpleNav"><a rel="me home" href="index.html">Go home</a></p>
<p class="simpleNav">If you had JavaScript turned on, you'd have more navigation options.</p>
</noscript>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-37778547-1']);
_gaq.push(['_setDomainName', 'nfshost.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<h1>Stats for Sarah Palin Quote, or Random Algorithmic Gibberish?</h1>""")
tdata = get_stats_dictionary()
times_taken = sum(tdata.values())
print("""<p><a rel="me" href="index.cgi">This quiz</a> has been taken %d times; users have correctly identified the source of quotes %0.2f %% of the time. Here are the totals:</p>
""" % (times_taken, 100 * ((tdata['sarah_right'] + tdata['algorithm_right']) / times_taken)))
print("""<div>
<table>
<thead>
<tr><th> </th><th> </th><th colspan="2" scope="colgroup">User Guess</th></tr>
<tr><th> </th><th> </th><th scope="col">Sarah Palin</th><th scope="col">Algorithm</th><th scope="col">Totals</th></tr>
</thead>
<tbody>
<tr><th rowspan="2" scope="rowgroup">Actual Source</th><th scope="row">Sarah Palin</th><td>%d (%0.2f%%)</td><td>%d (%0.2f%%)</td><td><span class="line-header">%d (%0.2f%%)</span></td></tr>
""" % (tdata['sarah_right'], 100 * (tdata['sarah_right'] / times_taken), tdata['algorithm_wrong'], 100 * (tdata['algorithm_wrong'] / times_taken), tdata['sarah_right'] + tdata['algorithm_wrong'], 100 * ((tdata['sarah_right'] + tdata['algorithm_wrong']) / times_taken)))
print(""" <tr><th scope="row">Algorithm</th><td>%d (%0.2f%%)</td><td>%d (%0.2f%%)</td><td><span class="line-header">%d (%0.2f%%)</span></td></tr>
""" % (tdata['sarah_wrong'], 100 * (tdata['sarah_wrong'] / times_taken), tdata['algorithm_right'], 100 * (tdata['algorithm_right'] / times_taken), tdata['sarah_wrong'] + tdata['algorithm_right'], 100 * ((tdata['sarah_wrong'] + tdata['algorithm_right']) / times_taken)))
print(""" <tr><td> </td><th scope="row">Totals</th><td><span class="line-header">%d (%0.2f%%)</span></td><td><span class="line-header">%d (%0.2f%%)</span></td><td> </td></tr>
</tbody>
</table>
</div>
""" % (tdata['sarah_wrong'] + tdata['sarah_right'], 100 * ((tdata['sarah_wrong'] + tdata['sarah_right']) / times_taken), tdata['algorithm_wrong'] + tdata['algorithm_right'], 100 * ((tdata['algorithm_wrong'] + tdata['algorithm_right']) / times_taken)))
print("""
<p>You can download the raw data <a rel="me" href="stats/stats.csv">here</a>, if you'd like.</p>
<p><a rel="me" href="index.cgi">Back to <q>Sarah Palin Quote, or Random Algorithmic Gibberish?</q></a></p>
<footer class="status vevent">
<p>This quiz has a <a rel="me" href="privacy.html">privacy policy</a> that you can read if you want. <span class="summary"><a class="url" href="#">This HTML file</a> was last updated</span> on <abbr class="dtstart" title="2017-12-06">the ninety-fifth anniversary of Northern Ireland's vote to remain part of Britain</abbr> (<span class="description">last change: minor coding changes while giving the whole site a facelift</span>).</p>
</footer>
</div></body>
</html>""")