-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathground-truth.html
95 lines (91 loc) · 4.44 KB
/
ground-truth.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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" href="css/twitter-style.css" type="text/css">
</head>
<body style="background-color: #B2D6E9; width: 90%; margin: auto" onload="topicSelection()">
<div>
Select a topic:
<select id = "topicSelect" onchange="topicSelection()">
<option></option>
<option value="003">3.Haiti Aristide return</option>
<option value="021">21.Emanuel residency court rulings</option>
<option value="022">22.healthcare law unconstitutional</option>
<option value="026">26.US unemployment</option>
<option value="042">42.Holland Iran envoy recall</option>
<option value="051">51.British Government cuts</option>
<option value="057">57.Chicago blizzard</option>
<option value="066">66.Journalists' treatment in Egypt</option>
<option value="068">68.Charlie Sheen rehab</option>
<option value="088">88.Kings' Speech awards</option>
</select>
</div>
<div id="main"></div>
<script type="text/javascript">
var tweetsPath = "data/relevant-chrono-sort-tweets/json/";
var clustersUrl = "data/semantic-clusters-ids/json/clusters-ids.json";
function topicSelection() {
choices = document.getElementById("topicSelect");
topicNum = choices[choices.selectedIndex].value;
var tweets = {};
$.ajax({
url: tweetsPath + "tweet_topic" + topicNum + ".json",
dataType: "text",
async: false,
success: function(json) {
var data = $.parseJSON(json);
for (var i = 0, tweet; i < data.tweets.length; i++) {
tweet = data.tweets[i];
tweets[tweet.id] = [tweet.time, tweet.name, tweet.screenname, tweet.text];
}
}
});
var html = "";
$.ajax({
url: clustersUrl,
dataType: "text",
async: false,
success: function(json) {
var data = $.parseJSON(json);
var clusters = data.topics["MB" + topicNum].clusters;
for (var i = 0; i < clusters.length; i ++) {
var tweet = tweets[clusters[i][0]];
html += "<div>";
html += "<table cellspacing='0' cellpadding='0' class='tweet'>";
html += "<tr><td>";
html += "<font><b>" + tweet[1] + "</b></font> ";
html += "<font class='gray'>@" + tweet[2] + "</font>";
html += "</td></tr>";
html += "<tr><td>";
html += "<div class='text'>" + tweet[3] + "</div>";
html += "</td></tr>";
html += "<tr><td>";
html += "<font class='gray'>" + timeConvert(tweet[0]) + "</font>";
html += "</td></tr>";
html += "</table>";
html += "</div>";
}
}
});
$("#main").html(html);
}
//Sun Jan 23 15:53:01 +0000 2011 --> 3:53 PM - 23 Jan 2011
function timeConvert(time) {
var twelve;
var hour = parseInt(time.substring(11, 13));
var minute = time.substring(14, 16);
if (hour == 12) {
twelve = "12:" + minute + " PM";
} else if ( hour > 12) {
twelve = (hour - 12) + ":" + minute + " PM";
} else {
twelve = hour + ":" + minute + " AM";
}
var result = twelve + " - " + time.substring(8, 10) + " " + time.substring(4, 7) + " " + time.substring(26, 30);
return result;
}
</script>
</body>
</html>