Nikhil Mane commited on
Commit
8bf5454
1 Parent(s): 59e4b2d

all analysis

Browse files
Files changed (4) hide show
  1. app.py +254 -189
  2. text.txt → ex_dream.txt +0 -0
  3. ex_tryst.txt +47 -0
  4. nlp_meme.jpg +0 -0
app.py CHANGED
@@ -28,206 +28,271 @@ import seaborn as sns
28
  import plotly.express as px
29
  from wordcloud import WordCloud, STOPWORDS
30
  from textstat import flesch_reading_ease
 
 
31
 
32
 
33
  from nltk.sentiment.vader import SentimentIntensityAnalyzer
34
  sid = SentimentIntensityAnalyzer()
35
 
36
- # Settings
 
 
 
 
 
 
 
37
 
38
- width = st.sidebar.slider("plot width", 1, 25, 10)
39
- height = st.sidebar.slider("plot height", 1, 25, 4)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- # Temp
42
- st.title("Text Disection : Analyze your text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
- # Input
46
- with st.container():
47
- text_file = 'text.txt'
48
- with open(text_file) as f:
49
- text = f.readlines()
50
- default = ' '.join(text)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  st.header(f"Your Text please..")
52
- text = st.text_area("Paste your text", default)
53
 
54
- # Baisc Info
55
- with st.container():
56
  tokenized_sent=sent_tokenize(text)
57
  tokenized_word=word_tokenize(text)
58
- fdist = FreqDist(tokenized_word)
59
- st.header("Basic Information >>")
60
- st.markdown(f"#### Total Sentences in the text = {len(tokenized_sent)}")
61
- st.markdown(f"#### Total words in the text = {len(tokenized_word)}")
62
- # st.markdown(f"##### Most common words = {fdist.most_common(5)}")
63
-
64
- # Word Cloud
65
- with st.container():
66
- st.header("Here is wordcloud >>")
67
- wc = WordCloud(background_color='black', colormap='RdYlGn').generate_from_text(text)
68
- fig, ax = plt.subplots(figsize=(width, height))
69
- plt.imshow(wc)
70
- plt.axis('off')
71
- st.pyplot(fig)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
- st.header("N-Gram Anaysis is >>")
74
- def plot_top_ngrams_barchart(text, n=2):
75
- stop=set(stopwords.words('english'))
76
-
77
- new= text.str.split()
78
- new=new.values.tolist()
79
- corpus=[word for i in new for word in i]
80
-
81
- def _get_top_ngram(corpus, n=None):
82
- vec = CountVectorizer(ngram_range=(n, n), stop_words=stop).fit(corpus)
83
- bag_of_words = vec.transform(corpus)
84
- sum_words = bag_of_words.sum(axis=0)
85
- words_freq = [(word, sum_words[0, idx])
86
- for word, idx in vec.vocabulary_.items()]
87
- words_freq =sorted(words_freq, key = lambda x: x[1], reverse=True)
88
- return words_freq[:10]
89
-
90
- top_n_bigrams=_get_top_ngram(text,n)[:10]
91
- x,y=map(list,zip(*top_n_bigrams))
92
- # fig, ax = plt.subplots(figsize=(width, height))
93
- # sns.barplot(x=y,y=x)
94
- fig = px.bar(x=y,y=x, color=y)
95
- fig.update_layout( yaxis=dict(autorange='reversed'))
96
- st.plotly_chart(fig)
97
- # st.pyplot()
98
- st.markdown(f'##### Unigram:')
99
- plot_top_ngrams_barchart(pd.Series([text]), 1)
100
- st.markdown(f'##### bigram:')
101
- plot_top_ngrams_barchart(pd.Series([text]), 2)
102
- st.markdown(f'##### Trigram:')
103
- plot_top_ngrams_barchart(pd.Series([text]), 3)
104
-
105
-
106
- # Overall Sentiment
107
-
108
- sentiment_dict = sid.polarity_scores(text)
109
- st.header(f"Sentiment Analysis >>")
110
- st.subheader(f"Overall Sentiment score is = {sentiment_dict['compound']}")
111
- # decide sentiment as positive, negative and neutral
112
- if sentiment_dict['compound'] >= 0.05 :
113
- st.markdown("** Sentence Overall Rated As Positive **")
114
-
115
- elif sentiment_dict['compound'] <= - 0.05 :
116
- st.markdown("** Sentence Overall Rated As Negative **")
117
-
118
- else :
119
- st.markdown("** Sentence Overall Rated As Neutral **")
120
-
121
- # Temporal sentiment
122
- st.subheader(f"Temporal Sentiment")
123
-
124
- temporal_sentiment = pd.DataFrame(columns =['sentence', 'sentiment', 'len_sent'])
125
- for sent in tokenized_sent:
126
- sentiment_dict = sid.polarity_scores(sent)
127
- temporal_sentiment = temporal_sentiment.append({'sentence' : sent,
128
- 'sentiment' :sentiment_dict['compound'],'len_sent' : len(sent.split())}, ignore_index=True)
129
- temporal_sentiment['sentiment_stretch'] = (temporal_sentiment['sentiment'] * temporal_sentiment['len_sent']).astype(float)
130
-
131
- fig = px.bar(temporal_sentiment, x=temporal_sentiment.index , y='sentiment',
132
- hover_data=['sentence','sentiment','sentiment_stretch'], color= (temporal_sentiment['sentiment'] > 0),
133
- color_discrete_map={True: 'green',False: 'red'})
134
- fig.update_layout(
135
- autosize=False,
136
- width=width*100,
137
- height=height*100)
138
- st.plotly_chart(fig)
139
-
140
- st.subheader(f"Temporal Sentiment Stretch")
141
- fig = px.bar(temporal_sentiment, x=temporal_sentiment.index , y='sentiment_stretch',
142
- hover_data=['sentence','sentiment','sentiment_stretch'], color= (temporal_sentiment['sentiment'] > 0),
143
- color_discrete_map={True: 'green',False: 'red'})
144
- fig.update_layout(
145
- autosize=False,
146
- width=width*100,
147
- height=height*100)
148
- st.plotly_chart(fig)
149
-
150
- # ner
151
- st.header(f"Named Entity Recognition >>")
152
- st.subheader(f"Top Entities .. ")
153
- doc=nlp(text)
154
-
155
- if st.button('Render NER ...'):
156
- st.markdown(displacy.render(doc, style='ent'), unsafe_allow_html=True)
157
-
158
- ent = [X.label_ for X in doc.ents]
159
- counter=Counter(ent)
160
- count=counter.most_common()
161
- x,y=map(list,zip(*count))
162
- fig = px.bar(x=y,y=x, color=y)
163
- fig.update_layout( yaxis=dict(autorange='reversed'))
164
- st.plotly_chart(fig)
165
-
166
- st.subheader(f"What Are Those Entities .. ")
167
- ent_type= st.selectbox("Select Named Entity :", x)
168
- ent_single = [X.text for X in doc.ents if X.label_ == ent_type]
169
- ent_single=[x for x in ent_single]
170
- counter=Counter(ent_single)
171
- count=counter.most_common()
172
- x,y=map(list,zip(*count))
173
- fig = px.bar(x=y,y=x, color=y)
174
- fig.update_layout( yaxis=dict(autorange='reversed'))
175
- st.plotly_chart(fig)
176
-
177
-
178
- # pos tags
179
- st.header(f"Part of Speech >>")
180
- st.subheader(f"Top POS ..")
181
- # st.markdown(displacy.render(doc, style='dep'), unsafe_allow_html=True)
182
- pos = nltk.pos_tag(tokenized_word)
183
- pos=list(map(list,zip(*pos)))[1]
184
- pos = [x for x in pos]
185
- counter=Counter(pos)
186
- count=counter.most_common()
187
- x,y=map(list,zip(*count))
188
- fig = px.bar(x=y,y=x, color=y)
189
- fig.update_layout( yaxis=dict(autorange='reversed'))
190
- st.plotly_chart(fig)
191
-
192
- st.subheader(f"What Are those POS .. ")
193
- pos_type= st.selectbox("Select POS :", x)
194
- pos_single = []
195
- pos = nltk.pos_tag(tokenized_word)
196
- for word,tag in pos:
197
- if tag==pos_type:
198
- pos_single.append(word)
199
-
200
- pos_single=[x for x in pos_single]
201
- counter=Counter(pos_single)
202
- count=counter.most_common()
203
- x,y=map(list,zip(*count))
204
- fig = px.bar(x=y,y=x, color=y)
205
- fig.update_layout( yaxis=dict(autorange='reversed'))
206
- st.plotly_chart(fig)
207
-
208
- # Text Complexity
209
- st.header(f"Text Complexity >>")
210
- st.caption(f"Higher scores indicate material that is easier to read,lower numbers mark harder-to-read passages:\
211
- – 0-30 College\
212
- – 50-60 High school\
213
- – 60+ Fourth grade")
214
- st.subheader(f"Flesch Reading Ease score is = {flesch_reading_ease(text)}")
215
-
216
- # Temporal sentiment
217
- st.subheader(f"Temporal Complexity")
218
-
219
- temporal_complexity= pd.DataFrame(columns =['sentence', 'complexity', 'len_sent'])
220
- for sent in tokenized_sent:
221
- complexity = flesch_reading_ease(sent)
222
- temporal_complexity = temporal_complexity.append({'sentence' : sent,
223
- 'complexity' :complexity,'len_sent' : len(sent.split())}, ignore_index=True)
224
- temporal_complexity['complexity_stretch'] = (temporal_complexity['complexity'] * temporal_complexity['len_sent']).astype(float)
225
-
226
- fig = px.bar(temporal_complexity, x=temporal_complexity.index , y='complexity',
227
- hover_data=['sentence','complexity','complexity_stretch'], color= (temporal_complexity['complexity'] > 30),
228
- color_discrete_map={True: 'green',False: 'red'})
229
- fig.update_layout(
230
- autosize=False,
231
- width=width*100,
232
- height=height*100)
233
- st.plotly_chart(fig)
 
28
  import plotly.express as px
29
  from wordcloud import WordCloud, STOPWORDS
30
  from textstat import flesch_reading_ease
31
+ # import SessionState
32
+
33
 
34
 
35
  from nltk.sentiment.vader import SentimentIntensityAnalyzer
36
  sid = SentimentIntensityAnalyzer()
37
 
38
+ def create_wordcloud(text):
39
+ st.header("Here is wordcloud..")
40
+ wc = WordCloud(width=width*100 , height=height*100 , background_color='white', colormap='prism', collocations = False).generate_from_text(text)
41
+ fig, ax = plt.subplots()
42
+ # fig, ax = plt.subplots(figsize=(width , height))
43
+ plt.imshow(wc, interpolation='bilinear')
44
+ plt.axis('off')
45
+ st.pyplot(fig)
46
 
47
+ # @st.cache(suppress_st_warning=True, allow_output_mutation=True)
48
+ def get_input():
49
+
50
+ text_dream= 'ex_dream.txt'
51
+ text_tryst= 'ex_tryst.txt'
52
+
53
+ with open(text_dream) as f:
54
+ dream = f.readlines()
55
+ with open(text_tryst) as f:
56
+ tryst = f.readlines()
57
+
58
+ if 'x' not in st.session_state:
59
+ st.session_state['x'] = ' '
60
+
61
+ if 'k' not in st.session_state:
62
+ st.session_state['k'] = 0
63
+
64
+ if st.button('Example: I have a dream - M. King'):
65
+ st.session_state['x'] = ' '.join(dream)
66
+
67
+ if st.button('Example: Tryst with destiny - J. Nehru'):
68
+ st.session_state['x'] = ' '.join(tryst)
69
+
70
+
71
+ em = st.empty()
72
+ if st.button('Clear'):
73
+ st.session_state['k']+=1
74
+ st.session_state['x'] = ' '
75
+
76
+ text = em.text_area("Paste your text or Click Example", value = st.session_state['x'] , key = st.session_state['k'], height=200, placeholder="Add here..")
77
+
78
+ return text
79
+
80
+ def create_ngram(text):
81
+ st.header("N-Gram Anaysis is >>")
82
+ def plot_top_ngrams_barchart(text, n=2):
83
+ stop=set(stopwords.words('english'))
84
+ new= text.str.split()
85
+ new=new.values.tolist()
86
+ corpus=[word for i in new for word in i]
87
+
88
+ def _get_top_ngram(corpus, n=None):
89
+ vec = CountVectorizer(ngram_range=(n, n), stop_words=stop).fit(corpus)
90
+ bag_of_words = vec.transform(corpus)
91
+ sum_words = bag_of_words.sum(axis=0)
92
+ words_freq = [(word, sum_words[0, idx])
93
+ for word, idx in vec.vocabulary_.items()]
94
+ words_freq =sorted(words_freq, key = lambda x: x[1], reverse=True)
95
+ return words_freq[:10]
96
+
97
+ top_n_bigrams=_get_top_ngram(text,n)[:10]
98
+ x,y=map(list,zip(*top_n_bigrams))
99
+ fig = px.bar(x=y,y=x, color=y)
100
+ fig.update_layout( yaxis=dict(autorange='reversed'))
101
+ fig.update_layout(autosize=False,width=width*100,height=height*100)
102
+ st.plotly_chart(fig)
103
+
104
+ st.subheader(f"Unigram:")
105
+ plot_top_ngrams_barchart(pd.Series([text]), 1)
106
+ st.subheader(f"Bigram:")
107
+ plot_top_ngrams_barchart(pd.Series([text]), 2)
108
+ st.subheader(f"Trigram:")
109
+ plot_top_ngrams_barchart(pd.Series([text]), 3)
110
+
111
+ # # Overall Sentiment
112
+ def create_sentiment(text, tokenized_sent):
113
+ sentiment_dict = sid.polarity_scores(text)
114
+ st.header(f"Sentiment Analysis >>")
115
+ st.subheader(f"Overall Sentiment score is = {sentiment_dict['compound']}")
116
+ # decide sentiment as positive, negative and neutral
117
+ if sentiment_dict['compound'] >= 0.05 :
118
+ st.subheader("Sentence Overall Rated As Positive")
119
+
120
+ elif sentiment_dict['compound'] <= - 0.05 :
121
+ st.subheader("Sentence Overall Rated As Negative")
122
+
123
+ else :
124
+ st.subheader("Sentence Overall Rated As Neutral")
125
+
126
+ # Temporal sentiment
127
+ st.subheader(f"Temporal Sentiment")
128
+
129
+ temporal_sentiment = pd.DataFrame(columns =['sentence', 'sentiment', 'len_sent'])
130
+ for sent in tokenized_sent:
131
+ sentiment_dict = sid.polarity_scores(sent)
132
+ temporal_sentiment = temporal_sentiment.append({'sentence' : sent,
133
+ 'sentiment' :sentiment_dict['compound'],'len_sent' : len(sent.split())}, ignore_index=True)
134
+ temporal_sentiment['sentiment_stretch'] = (temporal_sentiment['sentiment'] * temporal_sentiment['len_sent']).astype(float)
135
+
136
+ fig = px.bar(temporal_sentiment, x=temporal_sentiment.index , y='sentiment',
137
+ hover_data=['sentence','sentiment','sentiment_stretch'], color= (temporal_sentiment['sentiment'] > 0),
138
+ color_discrete_map={True: 'green',False: 'red'})
139
+ fig.update_layout(autosize=False,width=width*100,height=height*100)
140
+ st.plotly_chart(fig)
141
 
142
+ st.subheader(f"Temporal Sentiment Stretch")
143
+ fig = px.bar(temporal_sentiment, x=temporal_sentiment.index , y='sentiment_stretch',
144
+ hover_data=['sentence','sentiment','sentiment_stretch'], color= (temporal_sentiment['sentiment'] > 0),
145
+ color_discrete_map={True: 'green',False: 'red'})
146
+ fig.update_layout(autosize=False,width=width*100,height=height*100)
147
+ st.plotly_chart(fig)
148
+ # # ner
149
+ def nested_state(state):
150
+ # st.session_state['state_ner'] = state
151
+ st.session_state['nested_session'] = state
152
+
153
+ def create_ner(text):
154
+ # st.session_state['state_ner'] = True
155
+ st.header(f"Named Entity Recognition >>")
156
+ st.subheader(f"Top Entities .. ")
157
+ doc=nlp(text)
158
+
159
+ ent = [X.label_ for X in doc.ents]
160
+ counter=Counter(ent)
161
+ count=counter.most_common()
162
+ x,y=map(list,zip(*count))
163
+ fig = px.bar(x=y,y=x, color=y)
164
+ fig.update_layout( yaxis=dict(autorange='reversed'))
165
+ fig.update_layout(autosize=False,width=width*100,height=height*100)
166
+ st.plotly_chart(fig)
167
 
168
+ st.subheader(f"What Are Those Entities .. ")
169
+ ent_type= st.selectbox("Select Named Entity :", x, on_change=nested_state(True))
170
+ ent_single = [X.text for X in doc.ents if X.label_ == ent_type]
171
+ ent_single=[x for x in ent_single]
172
+ counter=Counter(ent_single)
173
+ count=counter.most_common()
174
+ x,y=map(list,zip(*count))
175
+ fig = px.bar(x=y,y=x, color=y)
176
+ fig.update_layout( yaxis=dict(autorange='reversed'))
177
+ fig.update_layout(autosize=False,width=width*100,height=height*100)
178
+ st.plotly_chart(fig)
179
+
180
+ if st.button("Render NER"):
181
+ st.markdown(displacy.render(doc, style='ent'), unsafe_allow_html=True)
182
+
183
+
184
+ # # pos tags
185
+ def create_pos(text):
186
+ st.session_state['state_ner'] = True
187
+ st.header(f"Part of Speech >>")
188
+ st.subheader(f"Top POS ..")
189
+ # st.markdown(displacy.render(doc, style='dep'), unsafe_allow_html=True)
190
+ pos = nltk.pos_tag(tokenized_word)
191
+ pos=list(map(list,zip(*pos)))[1]
192
+ pos = [x for x in pos]
193
+ counter=Counter(pos)
194
+ count=counter.most_common()
195
+ x,y=map(list,zip(*count))
196
+ fig = px.bar(x=y,y=x, color=y)
197
+ fig.update_layout( yaxis=dict(autorange='reversed'))
198
+ fig.update_layout(autosize=False,width=width*100,height=height*100)
199
+ st.plotly_chart(fig)
200
+
201
+ st.subheader(f"What Are those POS .. ")
202
+ pos_type= st.selectbox("Select POS :", x)
203
+ pos_single = []
204
+ pos = nltk.pos_tag(tokenized_word)
205
+ for word,tag in pos:
206
+ if tag==pos_type:
207
+ pos_single.append(word)
208
+
209
+ pos_single=[x for x in pos_single]
210
+ counter=Counter(pos_single)
211
+ count=counter.most_common()
212
+ x,y=map(list,zip(*count))
213
+ fig = px.bar(x=y,y=x, color=y)
214
+ fig.update_layout( yaxis=dict(autorange='reversed'))
215
+ fig.update_layout(autosize=False,width=width*100,height=height*100)
216
+ st.plotly_chart(fig)
217
 
218
+ # # Text Complexity
219
+ def create_complexity(text, tokenized_sent):
220
+ st.header(f"Text Complexity >>")
221
+ st.caption(f"Higher scores indicate material that is easier to read,lower numbers mark harder-to-read passages:\
222
+ 0-30 College\
223
+ 50-60 High school\
224
+ – 60+ Fourth grade")
225
+ st.subheader(f"Flesch Reading Ease score is = {flesch_reading_ease(text)}")
226
+
227
+ # Temporal sentiment
228
+ st.subheader(f"Temporal Complexity")
229
+
230
+ temporal_complexity= pd.DataFrame(columns =['sentence', 'complexity', 'len_sent'])
231
+ for sent in tokenized_sent:
232
+ complexity = flesch_reading_ease(sent)
233
+ temporal_complexity = temporal_complexity.append({'sentence' : sent,
234
+ 'complexity' :complexity,'len_sent' : len(sent.split())}, ignore_index=True)
235
+ temporal_complexity['complexity_stretch'] = (temporal_complexity['complexity'] * temporal_complexity['len_sent']).astype(float)
236
+
237
+ fig = px.bar(temporal_complexity, x=temporal_complexity.index , y='complexity',
238
+ hover_data=['sentence','complexity','complexity_stretch'], color= (temporal_complexity['complexity'] > 30),
239
+ color_discrete_map={True: 'green',False: 'red'})
240
+ fig.update_layout(autosize=False,width=width*100,height=height*100)
241
+ st.plotly_chart(fig)
242
+
243
+ if __name__ == '__main__':
244
+ m = st.markdown("""<style>div.stButton > button:first-child
245
+ {background-color: #dbe6c4;}
246
+ </style>""", unsafe_allow_html=True)
247
+
248
+ st.title("Text Disection : Analyze your text")
249
+ st.sidebar.header("Adjust Plot Dimensions")
250
+ width = st.sidebar.slider("Plot Width", 1, 25, 10)
251
+ height = st.sidebar.slider("Plot Height", 1, 25, 7)
252
+
253
+
254
+ # Input
255
  st.header(f"Your Text please..")
 
256
 
257
+ text = get_input()
 
258
  tokenized_sent=sent_tokenize(text)
259
  tokenized_word=word_tokenize(text)
260
+ st.markdown(f"###### Total Sentences in the text = {len(tokenized_sent)}")
261
+ st.markdown(f"###### Total words in the text = {len(tokenized_word)}")
262
+
263
+
264
+ st.sidebar.title("Analysis Type")
265
+ analysis = st.sidebar.radio("Select Analysis",
266
+ options = ['Wordcloud', 'N-Gram Analysis', 'Sentiment Analysis', 'Named Entity Recognition Analysis',
267
+ 'Part Of Speech Analysis', 'Text Complexity Analysis','Keep Calm!'], index=6)
268
+
269
+
270
+ if st.button("Complete Analysis"):
271
+ create_wordcloud(text)
272
+ create_ngram(text)
273
+ create_sentiment(text, tokenized_sent)
274
+ create_ner(text)
275
+ create_pos(text)
276
+ create_complexity(text, tokenized_sent)
277
+ analysis = 'Keep Calm!'
278
+
279
+ if analysis == 'Wordcloud':
280
+ create_wordcloud(text)
281
+ if analysis == 'N-Gram Analysis':
282
+ create_ngram(text)
283
+ if analysis == 'Sentiment Analysis':
284
+ create_sentiment(text, tokenized_sent)
285
+ if analysis == 'Named Entity Recognition Analysis':
286
+ create_ner(text)
287
+ if analysis == 'Part Of Speech Analysis':
288
+ create_pos(text)
289
+ if analysis == 'Text Complexity Analysis':
290
+ create_complexity(text, tokenized_sent)
291
+ if analysis == 'Keep Calm!':
292
+ st.image('nlp_meme.jpg')
293
+
294
+
295
+
296
+
297
+
298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
text.txt → ex_dream.txt RENAMED
File without changes
ex_tryst.txt ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Long years ago... we made a tryst with destiny, and now the time comes when we shall redeem our pledge, not wholly or in full measure, but very substantially.
2
+
3
+ At the stroke of the midnight hour, when the world sleeps, India will awake to life and freedom. A moment comes, which comes, but rarely in history, when we step out from the old to the new, when an age ends, and when the soul of a nation, long suppressed, finds utterance.
4
+
5
+ It is fitting that at this solemn moment we take the pledge of dedication to the service of India and her people and to the still larger cause of humanity.
6
+
7
+ At the dawn of history India started on her unending quest, and trackless centuries are filled with her striving and the grandeur of her success and her failures. Through good and ill fortune alike she has never lost sight of that quest or forgotten the ideals which gave her strength. We end today a period of ill fortune and India discovers herself again.
8
+
9
+ The achievement we celebrate today is but a step, an opening of opportunity, to the greater triumphs and achievements that await us. Are we brave enough and wise enough to grasp this opportunity and accept the challenge of the future?
10
+
11
+ Freedom and power bring responsibility. The responsibility rests upon this Assembly, a sovereign body representing the sovereign people of India. Before the birth of freedom we have endured all the pains of labour and our hearts are heavy with the memory of this sorrow. Some of those pains continue even now. Nevertheless, the past is over and it is the future that beckons to us now.
12
+
13
+ That future is not one of ease or resting but of incessant striving so that we may fulfil the pledges we have so often taken and the one we shall take today. The service of India means the service of the millions who suffer. It means the ending of poverty and ignorance and disease and inequality of opportunity.
14
+
15
+ The ambition of the greatest man of our generation has been to wipe every tear from every eye. That may be beyond us, but as long as there are tears and suffering, so long our work will not be over.
16
+
17
+ And so we have to labour and to work, and work hard, to give reality to our dreams. Those dreams are for India, but they are also for the world, for all the nations and peoples are too closely knit together today for anyone of them to imagine that it can live apart.
18
+
19
+ Peace has been said to be indivisible; so is freedom, so is prosperity now, and so also is disaster in this one world that can no longer be split into isolated fragments.
20
+
21
+ To the people of India, whose representatives we are, we make an appeal to join us with faith and confidence in this great adventure. This is no time for petty and destructive criticism, no time for ill will or blaming others. We have to build the noble mansion of free India where all her children may dwell.
22
+
23
+ The appointed day has come - the day appointed by destiny - and India stands forth again, after long slumber and struggle, awake, vital, free and independent. The past clings on to us still in some measure and we have to do much before we redeem the pledges we have so often taken. Yet the turning point is past, and history begins anew for us, the history which we shall live and act and others will write about.
24
+
25
+ It is a fateful moment for us in India, for all Asia and for the world. A new star rises, the star of freedom in the east, a new hope comes into being, a vision long cherished materialises. May the star never set and that hope never be betrayed!
26
+
27
+ We rejoice in that freedom, even though clouds surround us, and many of our people are sorrow-stricken and difficult problems encompass us. But freedom brings responsibilities and burdens and we have to face them in the spirit of a free and disciplined people.
28
+
29
+ On this day our first thoughts go to the architect of this freedom, the father of our nation, who, embodying the old spirit of India, held aloft the torch of freedom and lighted up the darkness that surrounded us.
30
+
31
+ We have often been unworthy followers of his and have strayed from his message, but not only we but succeeding generations will remember this message and bear the imprint in their hearts of this great son of India, magnificent in his faith and strength and courage and humility. We shall never allow that torch of freedom to be blown out, however high the wind or stormy the tempest.
32
+
33
+ Our next thoughts must be of the unknown volunteers and soldiers of freedom who, without praise or reward, have served India even unto death.
34
+
35
+ We think also of our brothers and sisters who have been cut off from us by political boundaries and who unhappily cannot share at present in the freedom that has come. They are of us and will remain of us whatever may happen, and we shall be sharers in their good and ill fortune alike.
36
+
37
+ The future beckons to us. Whither do we go and what shall be our endeavour? To bring freedom and opportunity to the common man, to the peasants and workers of India; to fight and end poverty and ignorance and disease; to build up a prosperous, democratic and progressive nation, and to create social, economic and political institutions which will ensure justice and fullness of life to every man and woman.
38
+
39
+ We have hard work ahead. There is no resting for any one of us till we redeem our pledge in full, till we make all the people of India what destiny intended them to be.
40
+
41
+ We are citizens of a great country, on the verge of bold advance, and we have to live up to that high standard. All of us, to whatever religion we may belong, are equally the children of India with equal rights, privileges and obligations. We cannot encourage communism or narrow-mindedness, for no nation can be great whose people are narrow in thought or in action.
42
+
43
+ To the nations and people of the world we send greetings and pledge ourselves to cooperate with them in furthering peace, freedom and democracy.
44
+
45
+ And to India, our much-loved motherland, the ancient, the eternal and the ever-new, we pay our reverent homage and we bind ourselves afresh to her service.
46
+
47
+ Jai Hind."
nlp_meme.jpg ADDED