Sa-m commited on
Commit
5577484
1 Parent(s): 5696ea4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -123,7 +123,7 @@ def concordance(text_Party,strng):
123
  save_stdout = sys.stdout
124
  result = StringIO()
125
  sys.stdout = result
126
- moby.concordance(strng,lines=10,width=82)
127
  sys.stdout = save_stdout
128
  s=result.getvalue().splitlines()
129
  return result.getvalue()
@@ -147,14 +147,14 @@ def fDistance(text2Party):
147
 
148
  def fDistancePlot(text2Party,plotN=30):
149
  '''
150
- most frequent words visualization
151
  '''
152
  word_tokens_party = word_tokenize(text2Party) #Tokenizing
153
  fdistance = FreqDist(word_tokens_party)
154
  plt.title('Frequency Distribution')
155
- plt.axis('off')
156
  plt.figure(figsize=(4,3))
157
  fdistance.plot(plotN)
 
158
  plt.tight_layout()
159
  buf = BytesIO()
160
  plt.savefig(buf)
@@ -166,10 +166,17 @@ def fDistancePlot(text2Party,plotN=30):
166
 
167
 
168
  def getSubjectivity(text):
169
- return TextBlob(text).sentiment.subjectivity
 
 
 
 
 
170
 
171
- # Create a function to get the polarity
172
  def getPolarity(text):
 
 
 
173
  return TextBlob(text).sentiment.polarity
174
 
175
 
 
123
  save_stdout = sys.stdout
124
  result = StringIO()
125
  sys.stdout = result
126
+ moby.concordance(strng,lines=4,width=82)
127
  sys.stdout = save_stdout
128
  s=result.getvalue().splitlines()
129
  return result.getvalue()
 
147
 
148
  def fDistancePlot(text2Party,plotN=30):
149
  '''
150
+ Most Frequent Words Visualization
151
  '''
152
  word_tokens_party = word_tokenize(text2Party) #Tokenizing
153
  fdistance = FreqDist(word_tokens_party)
154
  plt.title('Frequency Distribution')
 
155
  plt.figure(figsize=(4,3))
156
  fdistance.plot(plotN)
157
+ plt.axis('off')
158
  plt.tight_layout()
159
  buf = BytesIO()
160
  plt.savefig(buf)
 
166
 
167
 
168
  def getSubjectivity(text):
169
+
170
+ '''
171
+ Create a function to get the polarity
172
+ '''
173
+ return TextBlob(text).sentiment.subjectivity
174
+
175
 
 
176
  def getPolarity(text):
177
+ '''
178
+ Create a function to get the polarity
179
+ '''
180
  return TextBlob(text).sentiment.polarity
181
 
182