Spaces:
Running
Running
Benjamin Consolvo
commited on
Commit
·
2fd894f
1
Parent(s):
446912b
syntax
Browse files
app.py
CHANGED
@@ -132,7 +132,6 @@ class NewsSentiment:
|
|
132 |
self.newsapi = NewsApiClient(api_key=API_KEY)
|
133 |
self.sia = SentimentIntensityAnalyzer()
|
134 |
|
135 |
-
|
136 |
def get_news_sentiment(self, symbols):
|
137 |
'''
|
138 |
The News API has a rate limit of 100 requests per day for free accounts. If you exceed this limit, you'll get a rateLimited error. Example error message:
|
@@ -147,7 +146,7 @@ class NewsSentiment:
|
|
147 |
sort_by='publishedAt', # <-- fixed argument name
|
148 |
page=1)
|
149 |
compound_score = 0
|
150 |
-
for article in articles['articles'][:5] # Check first 5 articles
|
151 |
# print(f'article= {article}')
|
152 |
score = self.sia.polarity_scores(article['title'])['compound']
|
153 |
compound_score += score
|
|
|
132 |
self.newsapi = NewsApiClient(api_key=API_KEY)
|
133 |
self.sia = SentimentIntensityAnalyzer()
|
134 |
|
|
|
135 |
def get_news_sentiment(self, symbols):
|
136 |
'''
|
137 |
The News API has a rate limit of 100 requests per day for free accounts. If you exceed this limit, you'll get a rateLimited error. Example error message:
|
|
|
146 |
sort_by='publishedAt', # <-- fixed argument name
|
147 |
page=1)
|
148 |
compound_score = 0
|
149 |
+
for article in articles['articles'][:5]: # Check first 5 articles
|
150 |
# print(f'article= {article}')
|
151 |
score = self.sia.polarity_scores(article['title'])['compound']
|
152 |
compound_score += score
|