1
+ {% extends "bootstrap/base.html" %}
2
+
3
+ {% block content %}
4
+
5
+ < style type ="text/css ">
6
+ body {
7
+ font : 15 px/1.5 Arial, Helvetica, sans-serif;
8
+ }
9
+ .spinner-1 : before {
10
+ content : "" ;
11
+ box-sizing : border-box;
12
+ position : absolute;
13
+ top : 50% ;
14
+ left : 50% ;
15
+ height : 60px ;
16
+ width : 60px ;
17
+ margin-top : -30px ;
18
+ margin-left : -30px ;
19
+ border-radius : 50% ;
20
+ border : 6px solid transparent;
21
+ border-top-color : blue;
22
+ animation : spinner 0.7s linear infinite;
23
+ }
24
+ .jumbotron text-center {
25
+ background-color : green;
26
+ text-color : white;
27
+ }
28
+ @keyframes spinner {
29
+ to {
30
+ transform : rotate (360deg );
31
+ }
32
+
33
+ }
34
+ li { background-color : # BDBDBD ; }
35
+ li : nth-child (odd) { background-color : green; }
36
+ </ style >
37
+
38
+
39
+ < div class ="container ">
40
+ < div class ="jumbotron text-center ">
41
+ < h3 > < b > SENTIMENT ANALYSIS USING NLP< b > </ h3 >
42
+ < p > Text Summarization Tool</ p >
43
+ </ div >
44
+ </ div >
45
+
46
+ < div class ="container ">
47
+ < form method ="POST " action ="{{ url_for('analyse')}} " id ="myForm ">
48
+
49
+
50
+ < label > < strong > Enter Your Text Below< strong > </ label > < br >
51
+ < textarea class ="form-control " rows ="20 " cols ="40 " name ="rawtext "> </ textarea > < br >
52
+
53
+ < input type ="submit " onclick ="myAnalyser() " value ="Submit " class ="btn btn-primary ">
54
+ < input type ="button " onclick ="myFunction() " value ="Clear " class ="btn btn-outline-dark ">
55
+
56
+ < a href ="{{ url_for('index')}} " type ="button " class ="btn btn-danger " > Reset</ a >
57
+
58
+ </ form >
59
+
60
+ </ div >
61
+ < br />
62
+ < hr />
63
+ < div class ="main ">
64
+ < div class ="container ">
65
+ < div class ="card ">
66
+ < div class ="card-header ">
67
+ Main Points
68
+ </ div >
69
+ < div class ="card-body ">
70
+ < h5 class ="card-title "> < div class ="alert alert-primary " role ="alert ">
71
+ This text has {{number_of_tokens}} tokens with {{len_of_words}} important point
72
+ </ div > </ h5 >
73
+ < div class ="card-text ">
74
+ < h5 > Your Text</ h5 >
75
+ < p style ="color:#0091EA;font-family:sans-serif; "> {{ received_text }}</ p >
76
+ < hr />
77
+ < br />
78
+ < p > Time Elapsed: < span style ="color:#0091EA; "> {{ final_time }} </ span > seconds to analyse</ p >
79
+ < p > This text is about:</ p >
80
+ {% for i in summary %}
81
+ < ul class ="list-group ">
82
+ < li class ="list-group-item list-group-item-info "> < span style ="color:black "> {{i}}</ span >
83
+ < a href ="http://www.dictionary.com/browse/{{i}}?s= " target ="_blank " type ="button " class ="btn btn-outline-primary btn-sm " style ="float:right;font-size:9px;color:#fff; "> View</ a >
84
+
85
+ </ li >
86
+ </ ul >
87
+
88
+
89
+ {% endfor %}
90
+ </ div >
91
+ < div class ="card-footer text-muted ">
92
+ < table class ="table table-striped table-dark " >
93
+ < thead >
94
+ < tr >
95
+ < th scope ="col "> Sentiment</ th >
96
+ < th scope ="col "> Polarity</ th >
97
+ < th scope ="col "> Subjectivity</ th >
98
+ </ tr >
99
+ </ thead >
100
+ < tbody >
101
+ < tr >
102
+ < th scope ="row "> Score:</ th >
103
+ < td > {{blob_sentiment}}</ td >
104
+ < td > {{blob_subjectivity}}</ td >
105
+ </ tr >
106
+ </ tbody > </ table >
107
+
108
+ </ div >
109
+
110
+
111
+ </ div >
112
+ </ div >
113
+
114
+
115
+ {% endblock %}
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <!-- Scripts starts here -->
126
+ {% block scripts %}
127
+
128
+ {{ super() }}
129
+
130
+ < script >
131
+ function myFunction ( ) {
132
+ document . getElementById ( "myForm" ) . reset ( ) ;
133
+ }
134
+ </ script >
135
+ < script >
136
+ function myAnalyser ( ) {
137
+ document . querySelector ( '.main div' ) . style . display = 'none' ;
138
+ //Hide the main division
139
+ document . querySelector ( '.main' ) . classList . add ( 'spinner-1' ) ;
140
+ // Server request
141
+ setTimeout ( ( ) => {
142
+ document . querySelector ( '.main' ) . classList . remove ( 'spinner-1' ) ;
143
+ //Remove the animation
144
+ document . querySelector ( '.main div' ) . style . display = 'block' ;
145
+ //Show the main division
146
+ } , 5000 ) ; //Number of seconds to last
147
+ }
148
+ </ script >
149
+
150
+ <!-- Prevent it from being overwritten -->
151
+
152
+ {% endblock %}
0 commit comments