wira.indra commited on
Commit
9e9e229
1 Parent(s): d49f00b

add twitter feature

Browse files
Files changed (2) hide show
  1. app.py +0 -4
  2. twitter_scraper.py +0 -3
app.py CHANGED
@@ -1,7 +1,4 @@
1
  from transformers import pipeline
2
- import pandas as pd
3
- import re
4
- from tqdm import tqdm
5
  import matplotlib.pyplot as plt
6
  import twitter_scraper as ts
7
 
@@ -50,7 +47,6 @@ def sentiment_df(df):
50
  def twitter_analyzer(keyword, max_tweets):
51
  df = ts.scrape_tweets(keyword, max_tweets=max_tweets)
52
  df["Text"] = df["Text"].apply(ts.preprocess_text)
53
- print("Analyzing sentiment...")
54
  df = sentiment_df(df)
55
  fig = plt.figure()
56
  df.groupby(["Label"])["Text"].count().plot.pie(autopct="%.1f%%", figsize=(6,6))
 
1
  from transformers import pipeline
 
 
 
2
  import matplotlib.pyplot as plt
3
  import twitter_scraper as ts
4
 
 
47
  def twitter_analyzer(keyword, max_tweets):
48
  df = ts.scrape_tweets(keyword, max_tweets=max_tweets)
49
  df["Text"] = df["Text"].apply(ts.preprocess_text)
 
50
  df = sentiment_df(df)
51
  fig = plt.figure()
52
  df.groupby(["Label"])["Text"].count().plot.pie(autopct="%.1f%%", figsize=(6,6))
twitter_scraper.py CHANGED
@@ -1,8 +1,5 @@
1
  import snscrape.modules.twitter as sntwitter
2
- import datetime as dt
3
  import pandas as pd
4
- import sys
5
- import os
6
  import re
7
  import tqdm
8
 
 
1
  import snscrape.modules.twitter as sntwitter
 
2
  import pandas as pd
 
 
3
  import re
4
  import tqdm
5