-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.htm
184 lines (148 loc) · 6.34 KB
/
index.htm
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
<!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 property="og:locale" content="en_US" />
<meta property="og:type" content="article" />
<meta property="og:title" content="AFINN Sentiment Analysis" />
<meta property="og:description" content="Javascript sentiment analysis using a lexicon of words and their sentiment valence called AFINN" />
<meta property="og:url" content="https://darenr.github.io/afinn/" />
<meta property="og:image" content="https://darenr.github.io/afinn/afinn-app-screenshot.png" />
<meta property="og:site_name" content="github - daren race - afinn" />
<meta property="article:tag" content="sentiment analysis" />
<meta property="article:tag" content="daren race" />
<meta property="article:tag" content="machine learning" />
<meta property="article:section" content="Articles" />
<meta property="article:published_time" content="2018-10-02T10:00:36+00:00" />
<meta property="article:modified_time" content="2018-10-20T14:49:37+00:00" />
<meta property="og:updated_time" content="2018-11-02T14:49:37+00:00" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:description" content="Javascript sentiment analysis using a lexicon of words and their sentiment valence called AFINN" />
<meta name="twitter:title" content="AFINN Sentiment Analysis" />
<meta name="twitter:image" content="https://darenr.github.io/afinn/afinn-app-screenshot.png" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://bootswatch.com/3/darkly/bootstrap.min.css">
<style>
body {
padding-top: 70px;
padding-bottom: 30px;
}
.tooltip-inner {
text-align: left;
}
textarea {
width: 100%;
height: 180px;
min-height: 180px;
max-height: 180px;
padding: 10px;
}
pre {
background-color: white;
}
</style>
<title>AFINN Sentiment Analysis</title>
</head>
<body role="document">
<!-- Fixed navbar -->
<div class="container">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" 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="#">AFINN Sentiment Analysis</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6006/pdf/imm6006.pdf" target="_blank">AFINN: Evaluation of a word list for sentiment analysis in microblogs</a></li>
<li class="dropdown">
<div class="navbar-form">
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" type="button" id="languageSelector" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
English
</button>
<ul class="dropdown-menu">
<li><a class="languageSelector" href="#">English</span></a></li>
<li><a class="languageSelector" href="#">Danish</span></a></li>
</ul>
</div>
</div>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="container theme-showcase" role="main">
<div class="jumbotron">
<p>AFINN is a list of words rated for <a href="#" data-toggle="tooltip" title='Valence, as used in psychology, especially in discussing emotions, means the intrinsic attractiveness "good"-ness
or averseness "bad"-ness of an event, object, or situation. The term also characterizes and categorizes specific emotions'>valence</a>
with an integer between minus five (negative) and plus five (positive). This implementation uses <a href="http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6010">AFINN-en-165</a></p>
<h3>Enter some text below for real-time (in-browser) sentiment analysis:</h3>
<textarea id="txt"></textarea>
<h3>Verdict:</h3>
<pre id="result"></pre>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- English words -->
<script src="afinn_en.js"></script>
<!-- Danish words -->
<script src="afinn_da.js"></script>
<!-- Emoticons -->
<script src="afinn_emoticon.js"></script>
<!-- Algorithm -->
<script src="sentiment.js"></script>
<script>
var afinn = $.extend(afinn_en, afinn_emoticon);
function setLanguage(languageName) {
$("#result").empty();
$("#languageSelector").text(languageName);
switch (languageName) {
case 'English':
{
afinn = $.extend(afinn_en, afinn_emoticon);
break;
}
case 'Danish':
{
afinn = $.extend(afinn_da, afinn_emoticon);
break;
}
}
}
$(document).ready(function() {
$(".languageSelector").on("click", function(e) {
e.preventDefault();
setLanguage($(this).text());
});
$('[data-toggle="tooltip"]').tooltip({
'placement': 'bottom'
});
$('#txt').focus();
$('#txt').bind('input propertychange', function() {
var sentiment_result = sentiment($('#txt').val())
$('#result').text(JSON.stringify(sentiment_result, undefined, 2));
});
});
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-91393607-4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-91393607-4');
</script>
</html>