forked from imshashank/Sentiment-Analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·153 lines (134 loc) · 4.73 KB
/
Copy pathindex.php
File metadata and controls
executable file
·153 lines (134 loc) · 4.73 KB
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
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', true);
if($_POST['formSubmit'] == "Submit")
{
$errorMessage = "";
if(empty($_POST['formMovie']))
{
$errorMessage .= "<li>You forgot to enter the data!</li>";
}
$varMovie = $_POST['formMovie'];
if(empty($errorMessage))
{
$myFile = "article.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh,$varMovie);
fclose($fh);
// exec('javac articleAnalysis.java',$o);
exec('java articleAnalysis ', $output);
//print_r($output);
}
}
?><!DOCTYPE HTML>
<html>
<head>
<title>Sentiment Analysis by Shashank Agarwal</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,300italic" rel="stylesheet" type="text/css" />
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
<script src="js/jquery.min.js"></script>
<script src="js/jquery.poptrox-2.2.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
</noscript>
<!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]-->
</head>
<body>
<!-- Header -->
<section id="header">
<header>
<h1>Sentiment Analysis </h1>
<p>by Shashank Agarwal</p>
</header>
<footer>
<a href="#banner1" class="button style2 scrolly">About the project</a>
</footer>
</section>
<!-- Banner -->
<section id="banner">
<header id="banner1">
<h2>Sentiment Analysis</h2>
</header>
<p>This is a simple word by word analysis tool to rate a piece of text.<br />
I have used the the ANEW words and FINN lexicon as the lexicon base for analysis<br />
You can get the whole code at <a href="https://github.com/imshashank/Sentiment-Analysis">Github</a>.</p>
<footer>
<a href="#first" class="button style2 scrolly">Now let's analyze: </a>
</footer>
</section>
<!-- Contact -->
<section>
<article class="container box style3" >
<header>
<h2>Analysis</h2>
<p>Just enter the text to be analyzed</p>
</header>
<form action="index.php#rating" method="post" >
<div class="row half" id="first">
<div class="12u">
<textarea type="text" rows="4" cols="10" name="formMovie" value="" />
<?php if($_POST['formMovie']!=NULL) echo $_POST['formMovie'];
else echo "";?>
</textarea>
</div>
</div>
<div class="row">
<div class="12u">
<ul class="actions">
<li>
<input type="submit" name="formSubmit"class="button form" value="Submit" />
</li>
</ul>
</div>
</div>
</form>
</article>
</section>
<article class="container box style3" id="rating">
<section>
<header>
<h3>The ratings</h3>
</header>
<p>
<b>Anew Rating: </b><p> This rates the given text on a scale of 10 and tells how happy (+10) or sad(0) the text is.
Valence, dominance and arousal are different rating levels and have different mathematical meaning in the analysis.
</p>
<ol class="default">
<li><?php echo "Valence rating: " . $output[sizeof($output)-6];?>
</li>
<li><?php echo "Arousal rating: " . $output[sizeof($output)-5]; ?>
</li>
<li><?php echo "Dominance rating: " . $output[sizeof($output)-4]; ?>
</li>
</ol>
<p><b>Finn rating:</b></p>
<p>If u have a positive FINN rating, it means that the text had happy and positive feelings. While if it is below zero, it denotes sadness or
negativity. It has a scale of +5 to -5.
</p>
<ol class="default">
<li><?php echo "Finn rating: " . $output[sizeof($output)-2]."</br>";
echo $output[sizeof($output)-3];
?></li>
</ol>
</section></article>
<section id="footer">
<ul class="icons">
<li><a href="http://twitter.com/itsshashank" class="icon icon-twitter solo"><span>Twitter</span></a></li>
<li><a href="http://fb.me/agarwal.shashank" class="icon icon-facebook solo"><span>Facebook</span></a></li>
<li><a href="https://plus.google.com/107862114554859378569/posts" class="icon icon-google-plus solo"><span>Google+</span></a></li>
<li><a href="www.linkedin.com/pub/shashank-agarwal/2a/ba6/366/" class="icon icon-linkedin solo"><span>LinkedIn</span></a></li>
</ul>
<div class="copyright">
<ul class="menu">
<li>© Sentiment Analysis. All rights reserved.</li>
</ul>
</div>
</section>
</body>
</html>